Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Udev rules for identical hard drives
Date: Thu, 02 Aug 2012 00:44:14
Message-Id: 20120802024236.0c12da7c@weird.wonkology.org
In Reply to: Re: [gentoo-user] Udev rules for identical hard drives by "Canek Peláez Valdés"
1 Canek Peláez Valdés writes:
2
3 > On Wed, Aug 1, 2012 at 6:59 PM, Canek Peláez Valdés <caneko@×××××.com>
4 > wrote:
5 > > On Wed, Aug 1, 2012 at 6:34 PM, Alex Schuster <wonko@×××××××××.org>
6 > > wrote:
7 [...]
8 > >> Could there be another way to distinguish the drives, like looking
9 > >> at the partition scheme or something?
10 > >
11 > > If you want to distinguish partitions, I would recommend using labels
12 > > (in fstab too); those never change unless you specifically change
13 > > them. Then, no matter how you put them in your machine, they will get
14 > > mounted correctly, and then you don't need to fuzz with udev rules.
15 > > Also, as a superficial bonus, they get mounted using the label and it
16 > > looks nice in your file browser.
17
18 I'm aware of that, and I would use this, if I weren't using LVM and
19 encryption on top of that. So I do not deal with raw partitions at all,
20 but with partitions like /dev/mapper/root or /dev/weird/portage.
21
22 Oh, this gives me an idea of what to use as workaround: If what I would
23 like to have is not possible, I will add a little start script
24 in /etc/local.d/ which calls pvscan to check which volume groups belong
25 to which drives, and creates the symlinks.
26
27 > > The drives themselves I see no reason to recognize them, why do you
28 > > need to do that?
29
30 Well, I don't really *need* this. But it's convenient.
31
32 - I have a monitoring plasmoid on my desktop that shows whether a drive
33 is active or on standby, and also gives the temperature of my always
34 running system drive. If there were a mixup, calling hddtemp on a
35 sleeping drive would wake it up.
36
37 - I have different idle time settings in /etc/conf.d/hdparm, and I spin
38 down two drives immediately after I have booted.
39
40 - Same goes for a little script I use for suspend-to-ram. It makes use of
41 the rtcwake command to make the PC wake up in the morning (before I get
42 up), and along other stuff spins down drives.
43
44 - And I have different settings in /etc/smartd.conf.
45
46 > Oh, and I forgot; doesn't the links in /dev/disk/by-id,
47 > /dev/disk/by-label, /dev/disk/by-uuid do what you want to?
48
49 Those seem to list partitions only, not whole drives. A label for a drive
50 would be nice to have.
51
52 Uh, and here's the little start script I just wrote. No idea why I call
53 my drives hd1 to hd4 instead of using the name of the only volume group
54 they have, but I'll keep it like that for now.
55
56 str=$( pvscan )
57
58 hd()
59 {
60 hd=$( echo "$str" | grep "$1" | head -n 1 | awk '{print $2}' )
61 echo ${hd//[0-9]/}
62 }
63
64 ln -s $( hd "weird " ) /dev/hd1
65 ln -s $( hd "weird2" ) /dev/hd2
66 ln -s $( hd "weird3" ) /dev/hd3
67 ln -s $( hd "pata1" ) /dev/hd4
68
69
70 Wonko

Replies

Subject Author
Re: [gentoo-user] Udev rules for identical hard drives "Canek Peláez Valdés" <caneko@×××××.com>