How to install a USB disk on SME Server 7.x


Copyright © Darrell May <dmay@myezserver.com>
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License.

Release supported:
SME Server 7.x
Problem:  You want to use a USB disk on SME Server
Solution:
  Follow this HowTo

NOTE: The commands presented below are very DANGEROUS. If you do not fully understand Linux hard disk partitioning and formatting, please seek further assistance.


STEP 1: To start, I suggest you connect the USB drive to a SME 7.x test server. Get used to the commands below before you perform the same on a production server. On your test server, connect your USB drive and see whether it gets automatically recognized and what device is assigned to the drive. I recommend you reboot your test server after connecting the drive for the first time. Search /var/log/messages for an entry similar to the one below:

# tail -100 /var/log/messages

 

Dec 8 10:49:07 test fstab-sync[3298]: added mount point /media/usbdisk for /dev/sda1

STEP 2: USB drives typically ship with a FAT32 file system. Wipe the drive and prep for partitioning and reformatting as ext3 file system. Substitute the correct device identified above for /dev/sda1 below:

# dd if=/dev/zero of=/dev/sda1 bs=512 count=63

63+0 records in

63+0 records out

STEP 3: Partition the drive. The basic steps are highlighted then detailed below:

# fdisk /dev/sda1

Press p > Press n > Press p, partition 1, default 1 > Press w

# fdisk /dev/sda1

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

 

 

The number of cylinders for this disk is set to 10010.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m for help):


Command (m for help): p

 

Disk /dev/sda1: 82.3 GB, 82343245824 bytes

255 heads, 63 sectors/track, 10010 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

 

Command (m for help):


Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-10010, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-10010, default 10010):

Using default value 10010


Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: Re-reading the partition table failed with error 22: Invalid argument.

The kernel still uses the old table.

The new table will be used at the next reboot.

Syncing disks.

STEP 4: Format the drive:

# mkfs.ext3 /dev/sda1

mke2fs 1.35 (28-Feb-2004)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

10059776 inodes, 20103331 blocks

1005166 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=20971520

614 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000, 7962624, 11239424

 

Writing inode tables: done

Creating journal (8192 blocks):

done

Writing superblocks and filesystem accounting information:

done

 

This filesystem will be automatically checked every 36 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

STEP 5: Reboot the server.

# signal-event reboot

STEP 6: Verify your drive is recognized after reboot.

# tail -100 /var/log/messages

 

Dec 8 10:49:07 test fstab-sync[3298]: added mount point /media/usbdisk for /dev/sda1

STEP 7: Mount and test the drive.

# mount /media/usbdisk

 

# ll /media/usbdisk

total 20

drwx------ 2 root root 16384 Dec 8 10:42 lost+found