[wplug] USB drives and dev questions

Eric Cooper ecc at cmu.edu
Sat Dec 3 14:07:28 EST 2005


On Sat, Dec 03, 2005 at 12:58:03PM -0500, Gentgeen wrote:
> Currently, I have a Debian Testing box with 2 USB ports.  One has a
> printer, and the other I swap between my media card reader (SanDisk 5 in
> 1) and my thumbdrive.  Right now, no matter which one I plug in, it
> always maps to /dev/sda1
> 
> I am wondering if there is a way to get one to map to /dev/sda and the
> other to /dev/sdb, no matter when they are plugged in.

Create your own rules in /etc/udev/rules.d/local.rules, so you can
cause entries like /dev/cardreader and /dev/thumbdrive to be created
when the devices are plugged in.  For example, I use:

    BUS="scsi", SYSFS{model}="iPod", KERNEL="sd[a-z]2", SYMLINK="ipod"

to get a /dev/ipod node, and

    # Flash drives

    BUS="scsi", SYSFS{vendor}="DATACE", KERNEL="sd[a-z]1", SYMLINK="flash"
    BUS="scsi", SYSFS{vendor}="Kingston", KERNEL="sd[a-z]1", SYMLINK="flash"
    BUS="scsi", SYSFS{vendor}="LEXAR", KERNEL="sd[a-z]1", SYMLINK="flash"
    BUS="scsi", SYSFS{vendor}="SanDisk ", KERNEL="sd[a-z]1", SYMLINK="flash"
    BUS="scsi", SYSFS{vendor}="SMSC", KERNEL="sd[a-z]1", SYMLINK="flash"

to get /dev/flash for a variety of thumb drives.  (This won't work if
you want to use more than one thumb drive at a time, but you can get
fancier and add sequence numbers etc.)

See the man pages for udev, and /usr/share/doc/udev/writing_udev_rules/.

-- 
Eric Cooper             e c c @ c m u . e d u


More information about the wplug mailing list