Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Udev rules for identical hard drives
Date: Thu, 02 Aug 2012 00:01:05
Message-Id: CADPrc80MDOPdykn_G4mZ_DKyw=Rwr4buMbi-vDRZ4ZZu1s84Ew@mail.gmail.com
In Reply to: [gentoo-user] Udev rules for identical hard drives by Alex Schuster
1 On Wed, Aug 1, 2012 at 6:34 PM, Alex Schuster <wonko@×××××××××.org> wrote:
2 > Hi there!
3 >
4 > I do not understand the numbering of my hard drives. There may be some
5 > inherent logic, but whenever I make some changes, like replacing drives,
6 > or changing BIOS settings, the order changes. Maybe it's even more random.
7 >
8 > So I made some udev rules like this, and my drives are called /dev/hd1,
9 > hd2 and hd3:
10 >
11 > SUBSYSTEMS=="scsi", KERNEL=="sd?", ATTRS{model}=="SAMSUNG HD154UI",
12 > SYMLINK="hd1"
13 >
14 > This works fine, and this way I can address them in scripts, smartd and
15 > hdparm config files and such. But now I have two identical drives. I had
16 > this before with the drive above, but while being identical models, the
17 > two drives differed a little in size, so I just had to add ATTR{size}.
18 > This does not help with my current drives, and I find nothing
19 > in /sys/block/sd?/device/ that differs. Could there be another way to
20 > distinguish the drives, like looking at the partition scheme or something?
21
22 If you want to distinguish partitions, I would recommend using labels
23 (in fstab too); those never change unless you specifically change
24 them. Then, no matter how you put them in your machine, they will get
25 mounted correctly, and then you don't need to fuzz with udev rules.
26 Also, as a superficial bonus, they get mounted using the label and it
27 looks nice in your file browser.
28
29 The drives themselves I see no reason to recognize them, why do you
30 need to do that?
31
32 Regards.
33 --
34 Canek Peláez Valdés
35 Posgrado en Ciencia e Ingeniería de la Computación
36 Universidad Nacional Autónoma de México

Replies

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