Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] Re: USB device mappings


On Wed, Jul 27, 2005 at 01:04:06PM +0200, Ben Buxton wrote:
> How can one go about ensuring that certain USB mass-storage devices
> always get linked to the right /dev node, irregardless of the order that
> they're plugged into?
> 
> I'd like to have things where by for example, my camera always appears
> ad /dev/sda, my USB key as /dev/sdb, etc. It seems that they are
> allocated in the order they're attached, but this makes things rather
> complicated as I have to keep hunting for which device something's
> attacehd to.

I don't think you can have the same device mapped to the same /dev node.
What you can do is have custom hotplug scripts mount whatever device nodes
come up when you plug the device in.  It's slightly tricky to start with
(hotplug is the quintessential maze-of-twisty-passages shell script) but
duplicating it for lots o' devices isn't hard.  Unfortunately, I don't have
any of my hotplug magic with me, so I can't attach scripts for your perusal. 
That's because...

I've recently switched to a new Ubuntu laptop, where all of the hotplug
stuff has been completely changed in some way, related to GNOME's
HAL/dbus/udev/whatever system, so I don't need to dicker around with my
hotplug stuff.  Now, usb-storage devices get mounted to /media/<name>, where
<name> is either the FS volume label, if it has one, or usbdisk-<n>
otherwise.  That's quite cool, and I imagine you can either set the FS
volume label on everything you usually plug in (and hence always access it
through /media/<volumelabel>), or hack the underlying technology to match a
GUID to a name, and mount to that (which would be tres cool for stuff you
can't set the volume label on for whatever reason).

- Matt

Attachment: signature.asc
Description: Digital signature