Adding a USB disk to a Linux box:
You should not need to reboot the machine for it to see the disk.
If this is the first disk for the USB port, just plug it in.
If you are removing a disk to replace it with another,
be sure to unmount the existing disk before replacing with the other.
ex. umount /home/makani4 , followed by
umount /export/makani4 (use the -f option to umount for force
if it doesn't want to do it. If it
still won't unmount, make sure no one is
sitting in that directory)
With new disk plugged in the USB port;
# fdisk -l (to see what it sees the disk as)
You will have to know what was existing prior to plugging in
the new disk so you can tell which is the new one.
then, for example if 'fdisk -l' shows that the new disk is seen as /dev/sdb and is not formatted, you will run
#fdisk /dev/sdb
# m (shows all possible commands)
# n ( to add new partition)
(if you only want one partition just take defaults)
# w (to write label to disk)
---------------------------------
Now you will need to create a filesystem on the disk.
I'm using the "-T largefile" so that less inodes get created because you are putting only large files on the disk.
#[root@makani root]# mke2fs -j -m 1 -T largefile /dev/sdb1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
477056 inodes, 122098008 blocks
1220980 blocks (1.00%) reserved for the super user First data block=0
3727 block groups
32768 blocks per group, 32768 fragments per group
128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or 180 days, whichever comes first.
Use tune2fs -c or -i to override.
-----------------------------------
You disk is now ready for mounting.
There is an alias setup for root.
(alias makani4='mount /dev/sdb1 /export/makani4')
As long as the disk shows up as/dev/sdb, then all you need to do is
#makani4
# df -k
Filesystem 1K-blocks Used AvailableUse % Mounted on
/dev/hda3 114944108 69448788 39656496 64% /
/dev/hda1 202220 47256 144524 25% /boot
none 1027476 0 1027476 0% /dev/shm
/dev/hdb1 115345508 44539500 64946704 41% /export/makani1
/dev/hde1 241263968 199147316 39665536 84% /export/makani2
/dev/sda1 211679352 89839428 119689384 43% /export/makani3
/dev/sdb1 488300352 32828 483383604 1% /export/makani4