Gentoo Archives: gentoo-user

From: daid kahl <daidxor@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Double nautilus windows for each USB flash drive plugged in
Date: Sat, 03 Oct 2009 19:11:24
Message-Id: 3ac129340910031211t7d5be74bhb98deb2fae618730@mail.gmail.com
In Reply to: Re: [gentoo-user] Double nautilus windows for each USB flash drive plugged in by Stroller
1 > ...
2 >> Another useful notion is to use udev to automount flash drives (or
3 >> external usb harddrives) to a specified location based on serial number.
4 >> ... I can either give an overview or dig up the url if anyone likes.
5 >>
6 >
7 > I'd have assumed you simple used any of the usual "automount drives with
8 > udev" guides. Am I wrong?
9 >
10 > This is the way I have always intended to approach this problem, so I'd be
11 > grateful to be corrected in advance if there's a better way.
12 >
13 >
14 That's correct, except not all of these guides discuss the drive serial
15 number. If you want to ensure that different drives are mounted at
16 different points, you have to rely on the device serial (since the /dev
17 nodes are filled in order of the device connection, regardless of which
18 drive it is).
19
20 There are plenty of guides that mention how to find the serial number and
21 how to write the correct udev rules, but most the guides are outdated and
22 suggest use of the symlink udevinfo, which was removed upstream recently.
23 So, to get a device's serial number, for example (replace /dev/sdb with the
24 correct node) :
25
26 # udevadm info -a -p $(udevadm info -q path -n /dev/sdb) | grep
27 ATTRS{serial}
28
29 and use the (first) serial that doesn't have colons and periods. Then for
30 the udev rule you just need to include ATTRS{serial}==" 0000000000"
31
32 This is also useful when you have external harddrives that use ext3
33 formatting and flashdrives that don't.
34
35 ~daid

Replies

Subject Author
Re: [gentoo-user] Double nautilus windows for each USB flash drive plugged in Stroller <stroller@××××××××××××××××××.uk>