On Wed, Aug 1, 2012 at 6:34 PM, Alex Schuster <wo...@wonkology.org> wrote:
> Hi there!
>
> I do not understand the numbering of my hard drives. There may be some
> inherent logic, but whenever I make some changes, like replacing drives,
> or changing BIOS settings, the order changes. Maybe it's even more random.
>
> So I made some udev rules like this, and my drives are called /dev/hd1,
> hd2 and hd3:
>
> SUBSYSTEMS=="scsi", KERNEL=="sd?", ATTRS{model}=="SAMSUNG HD154UI",
> SYMLINK="hd1"
>
> This works fine, and this way I can address them in scripts, smartd and
> hdparm config files and such. But now I have two identical drives. I had
> this before with the drive above, but while being identical models, the
> two drives differed a little in size, so I just had to add ATTR{size}.
> This does not help with my current drives, and I find nothing
> in /sys/block/sd?/device/ that differs. Could there be another way to
> distinguish the drives, like looking at the partition scheme or something?

If you want to distinguish partitions, I would recommend using labels
(in fstab too); those never change unless you specifically change
them. Then, no matter how you put them in your machine, they will get
mounted correctly, and then you don't need to fuzz with udev rules.
Also, as a superficial bonus, they get mounted using the label and it
looks nice in your file browser.

The drives themselves I see no reason to recognize them, why do you
need to do that?

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México

Reply via email to