Stephen Gran on 6 Jan 2007 00:41:15 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Device ID coolness


On Fri, Jan 05, 2007 at 07:00:54PM -0500, Walt Mankowski said:
> The by-label directory was the most useful for my purposes.  Instead
> of /dev/sdb1 or /dev/sdc1, it lets me use the device name
> /dev/disk/by-id/usb-SanDisk_U3_Cruzer_Micro_0000060512013154-part1.
> That's a mouthful, but it has the big advantage of always being the
> same no matter which USB port it's using.

If you are using udev, it is also very good for this sort of thing.

/etc/udev/rules.d/local.rules:

BUS=="usb", SYSFS{manufacturer}=="LEXAR MEDIA", SYSFS{product}=="JUMPDRIVE ELITE", \
    KERNEL=="sd*", SYMLINK+="pendrive%n", MODE="0660", GROUP="cdrom"
BUS=="usb", SYSFS{manufacturer}=="Apple", SYSFS{product}=="iPod mini", \
    KERNEL=="sd*", SYMLINK+="ipod%n", MODE="0660", GROUP="cdrom"
BUS=="scsi", ATTRS{model}=="Disk            ", ATTRS{vendor}=="Easy    " \
    KERNEL=="sd*", SYMLINK+="pendrive%n", MODE="0660", GROUP="cdrom"

(Note how two physical devices map to /dev/pendrive1 - that's the cool
part from my point of view - once I know I about a pendrive, I can mount
it at the same place as the others.  This does have the downside that I
can't mount two pendrives simultaneously)

udev rules can be obtained by running udevinfo -a -p /sys/block/sda (for
instance) and looking for something the looks reasonably unique.  I
happen to use group cdrom for removable drives, but your distro might
have set something else up for you.

/etc/fstab:
/dev/pendrive1 /media/jumpdrive vfat    rw,noexec,user,noauto  0   0
/dev/ipod      /media/ipod      hfsplus rw,noexec,user,noauto  0   0

Hope that's helpful,
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | I just thought of something             |
|  steve@lobefin.net             | funny...your mother. - Cheech Marin     |
|  http://www.lobefin.net/~steve |                                         |
 --------------------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug