Translation(s): none

(!) ?Discussion


It is often useful to have a canonical name for your USB devices. This is easy to set up using udev. The following example is a modified /etc/udev/hal.rules that creates symlinks from /dev/mykey to /dev/sd*1 and from /dev/myusbdisk to /dev/sd*1, regardless the order they got plugged in. Only the first 4 uncommented lines have been added to the default configuration. You will need to modify the SYSFS{model}="<name>" according to the entries you find in /sys/bus/scsi/devices/*/model.

/etc/udev/hal.rules

        # put removable IDE/SCSI devices into the hal group instead of 'disk'
        BUS="scsi", KERNEL="sd[a-z]*1", SYSFS{model}="JUMPDRIVE", SYMLINK="mykey", \
                PROGRAM="/etc/udev/scripts/device-removable.sh %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
        BUS="scsi", KERNEL="sd[a-z]*1", SYSFS{model}="["SP1604N"]", SYMLINK="myusbdisk", \
                PROGRAM="/etc/udev/scripts/device-removable.sh %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
        BUS="scsi",KERNEL="sd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
        # BUS="ide", KERNEL="hd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
        BUS="usb", KERNEL="ub[a-z]*", NAME="%k", MODE="0640", GROUP="hal"

'?tail -f /var/log/syslog' is useful to debug these new udev rules.

you can then add the following lines in your fstab:

        /dev/mykey      /media/key      auto    rw,user         0       0
        /dev/myusbdisk  /media/disk     auto    rw,user         0       0

# Media devices (cameras, MP3 players, etc., identified by "id" (a concatenation of kernel information
# gathered after the device is connected.))  This information should be unique and static per device.
/dev/disk/by-id/usb-OLYMPUS_C-4040ZOOM_000197334942-part1 /media/OLYMPUS_C-4040ZOOM auto rw,user,noauto 0 0
/dev/disk/by-id/usb-NIKON_DSC_COOLPIX_P1_000030409725-part1 /media/NIKON_DSC_COOLPIX_P1 auto rw,user,noauto 0 0


USB