> ...
>> Another useful notion is to use udev to automount flash drives (or
>> external usb harddrives)  to a specified location based on serial number.
>> ... I can either give an overview or dig up the url if anyone likes.
>>
>
> I'd have assumed you simple used any of the usual "automount drives with
> udev" guides. Am I wrong?
>
> This is the way I have always intended to approach this problem, so I'd be
> grateful to be corrected in advance if there's a better way.
>
>
That's correct, except not all of these guides discuss the drive serial
number.  If you want to ensure that different drives are mounted at
different points, you have to rely on the device serial (since the /dev
nodes are filled in order of the device connection, regardless of which
drive it is).

There are plenty of guides that mention how to find the serial number and
how to write the correct udev rules, but most the guides are outdated and
suggest use of the symlink udevinfo, which was removed upstream recently.
So, to get a device's serial number, for example (replace /dev/sdb with the
correct node) :

# udevadm info -a -p $(udevadm info -q path -n /dev/sdb) | grep
ATTRS{serial}

and use the (first) serial that doesn't have colons and periods.  Then for
the udev rule you just need to include ATTRS{serial}==" 0000000000"

This is also useful when you have external harddrives that use ext3
formatting and flashdrives that don't.

~daid

Reply via email to