Walt Mankowski on 6 Jan 2007 00:01:02 -0000


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

[PLUG] Device ID coolness


At Wednesday night's meeting I asked for suggestions on mounting USB
devices like flash drives.  I thought I'd report back on how I made
out.

The problem seemed kind of tricky, because the device name the kernel
uses can vary depending on whether any other USB devices are plugged
in.  I was getting tired of editing /etc/fstab every time I tried to
mount it to change /dev/sdb1 to /dev/sdc1.

Someone at the meeting suggested that I look at device IDs.  That
turned out to be exactly what I was looking for.  I discovered that
under /dev/disk the kernel puts four directories -- by-id/, by-label/,
by-path/, and by-uuid/, each of which contains symlinks with symbolic
names that point back to the raw device names they refer to.

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.

Walt

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