#By Wan Nor Arifin @ chii-chan

*Mounting external USB drive

These lines are for USB drive mounting.

/dev/sda1               /mnt/usb1               auto    user,sync,noauto,umask=0000 0 0
/dev/sda                /mnt/usb4               auto    user,sync,noauto,umask=0000 0 0

/dev/sdb1               /mnt/usb5               auto    user,sync,noauto,umask=0000 0 0
/dev/sdb                /mnt/usb6               auto    user,sync,noauto,umask=0000 0 0

/dev/sda5               /mnt/usb2               auto    user,sync,noauto,umask=0000 0 0
/dev/sda6               /mnt/usb3               auto    user,sync,noauto,umask=0000 0 0

#/dev/sda1 or /dev/sda
sd: scsi disk.
a: 1st drive
1: 1st partition.

#/mnt/usb1
Where you like to mount the drive.

#auto
It depends. Auto works just fine. You can put vfat there.

#user
Allow user to mount the drive

#sync
Read/Write to the drive on real time. Without the "sync" part, the default would be "async" and the data would be written to the drive when you unmount the drive. Really painful for USB 1.1.

#noauto
Do not auto mount the drive.

#umask=0000
I would prefer full access here. (777 -777 = 000)

You should understand that Linux mount USB 1.1 and USB 2.0 differently. When you insert a USB 1.1 drive, it would be detected as /dev/sda1. If you mount a USB 2.0 drive it would be detected as /dev/sda.

If you have two usb ports and you insert a second USB drive, it would be detected as /dev/sdb1 or /dev/sdb, depending on whether you inserted USB 1.1 or USB 2.0 drive. If you remove the 1st (/dev/sda1 or /dev/sda) and 2nd (/dev/sdb1 or /dev/sdb) usb drives, the next one inserted would be detected as /dev/sdc1 or /dev/sdc.

This is true for kernel 2.4.x. For kernel 2.6.x, it would be reset when you remove the drive, which mean, when you remove /dev/sda1 (1st drive), and insert the second usb drive, it would take /dev/sda1 again.

But for kernel 2.4.x users, you have to reload the "usb-drive" module, for you to have the second usb drive to take /dev/sda1 designation. What I did is having a script like this:

#!/bin/bash
#re-usb

sudo /sbin/rmmod usb-storage;sudo /sbin/insmod usb-storage;sudo /sbin/modprobe usb-storage

I name the script as re-usb, put in my home directory (don't forget chmod 755 re-usb).

The I changed the /etc/sudoers file like this:

...

# User privilege specification
root    ALL=(ALL) ALL
myname  ALL=NOPASSWD: /sbin/rmmod usb-storage,/sbin/insmod usb-storage

...

using 'visudo'.

So if you run the script as user, you would not have to supply the password even though running as root/super user.

So for these two lines:

/dev/sda5               /mnt/usb2               auto    user,sync,noauto,umask=0000 0 0
/dev/sda6               /mnt/usb3               auto    user,sync,noauto,umask=0000 0 0

is for usb drive with many partitions, no matter whether it is USB 1.1 or 2.0. Let say, I have a usb drive with one primary partition, and two extended partitions, the primary partition would be /dev/sda1 while the other two extended partitions would be /dev/sda5 and /dev/sda6 accordingly. Why sda5/sda6? Because of the EXTENDED partition nature. The extended partition itself is /dev/sda2, then divided to two partitions, /dev/sda5 and /dev/sda6. It starts with "5" because the limit of primary partition is only up to 4 partitions. If you partition the drive without extended partition, the three partitions would be /dev/sda1, /dev/sda2, and /dev/sda3. So change the fstab to your liking. 1