auto-mounting USB drives

Raphael Schneider rasch_sub at med1.med.tum.de
Sun Aug 13 12:24:15 UTC 2006


On Sunday 13 August 2006 13:18, pkaplan1 at comcast.net wrote:
> I chose to use /etc/fstab entries since it fixed the mountpoints for the
> drive/partitions.  Any ideas on other ways to either force the specific
> drive to always mount at the same location even if other hardware is
> present? Paul
I am using udev rules to assign fixed names to my USB devices. 
In /etc/udev/rules.d I have the file /etc/udev/rules.d/10-locals.rules with 
the following content:
BUS="scsi", SYSFS{model}="iPod            ", KERNEL="sd*", NAME="%k", \ 
SYMLINK="ipod"
BUS="scsi", SYSFS{model}="Flash Disk      ", KERNEL="sd*", NAME="%k", \ 
SYMLINK="usb1gb"
BUS="scsi", SYSFS{model}="2500JB External ", KERNEL="sd*", NAME="%k", \ 
SYMLINK="wd250g"
BUS="scsi", SYSFS{model}="5000KS External ", KERNEL="sd*", NAME="%k", \ 
SYMLINK="wd500g"
BUS="scsi", SYSFS{model}="USBDrive        ", KERNEL="sd*", NAME="%k", \ 
SYMLINK="usb2gb"

('\' means "real" line continues on next "text" line)

This entries generate symlinks in /dev to the actual used sd entry. For 
example when I attach my 250GB Western Digital external drive, the 
entry /dev/wd250g is created and I can use this to mount the drive.

To get the name your drive is used, look in /var/log/messages after attaching 
your drive to see what name your drive is using.

HTH
Raphael




More information about the ubuntu-users mailing list