
Daniel Lawson wrote:
As I understand it, this is less than trivial. For example, say you have two usb sticks. if you swap them to different ports can you really expect udev to still be able to identify them uniqely? Many devices have no way of doing this that is consistent. If you attempt to create a method to implement this, it very quickly becomes a messy black art type situation, where guesswork is as useful as good programming.
In the case of USB sticks, it's trivial for a couple of reasons:
First of all, all USB devices have a unique serial number. This means you can canonically identify a particular USB stick, regardless of filesystem, and create a udev rule to mount it or name it something.
Secondly, the filesystem within the device will have a GUID, which can be used to identify that particular filesystem. If you format the filesystem the GUID will change, but assuming that doesn't happen, you can still write a udev rule to specify where to mount the device.
Unfortunately you picked a bad example :)
I just finished setting up all Verne's sound devices, so I have a little more perspective to add. I don't think ubuntu should have started using udev at all in dapper until they had a little more 'management' behind it. Here's what I envision; during the install ubuntu should identify each PCI device and write udev rules similar to what I've just had to write to keep them in fixed order. This quite easily solves the problem with soundcards and network cards. Same for USB filesystems, based on filesystem ID as Daniel suggests. New devices get subsequent numbers and when a device goes away, perhaps the user should have the option to to free up that device entry or keep it.. Other USB devices might be a bit harder, but if it's the same thing plugged into the same socket most users are going to expect it to appear as the same device on two consecutive reboots! I can see a LOT of frustration arising from this change. A GUI admin tool that lets you easily swap things around would also be nice.