On 3 Oct 2009, at 20:11, daid kahl wrote:
...
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.
Ooooops... I omitted a paste - I went to a terminal to check the
details and then appear to have completely forgotten to include them.
Thus my question is misphrased & incomplete.
I intended to ask:
I'd have assumed you simple used any of the usual "automount
drives with udev" guides, but based their entry in "/dev/disk/by-
uuid/". Am I wrong?
How do you find the serial, please? I'm guessing from `dmesg`?
I think the entry in "/dev/disk/by-uuid/" may change if you reformat
the drive, so your response is most helpful.
Thank you for your help,
Stroller.