Canek Peláez Valdés writes:

> On Wed, Aug 1, 2012 at 6:59 PM, Canek Peláez Valdés <can...@gmail.com>
> wrote:
> > On Wed, Aug 1, 2012 at 6:34 PM, Alex Schuster <wo...@wonkology.org>
> > wrote:
[...]
> >> 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.

I'm aware of that, and I would use this, if I weren't using LVM and
encryption on top of that. So I do not deal with raw partitions at all,
but with partitions like /dev/mapper/root or /dev/weird/portage.

Oh, this gives me an idea of what to use as workaround: If what I would
like to have is not possible, I will add a little start script
in /etc/local.d/ which calls pvscan to check which volume groups belong
to which drives, and creates the symlinks.

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

Well, I don't really *need* this. But it's convenient.

- I have a monitoring plasmoid on my desktop that shows whether a drive
  is active or on standby, and also gives the temperature of my always
  running system drive. If there were a mixup, calling hddtemp on a
  sleeping drive would wake it up.

- I have different idle time settings in /etc/conf.d/hdparm, and I spin
  down two drives immediately after I have booted.

- Same goes for a little script I use for suspend-to-ram. It makes use of
  the rtcwake command to make the PC wake up in the morning (before I get
  up), and along other stuff spins down drives.

- And I have different settings in /etc/smartd.conf.

> Oh, and I forgot; doesn't the links in /dev/disk/by-id,
> /dev/disk/by-label, /dev/disk/by-uuid do what you want to?

Those seem to list partitions only, not whole drives. A label for a drive
would be nice to have.

Uh, and here's the little start script I just wrote. No idea why I call
my drives hd1 to hd4 instead of using the name of the only volume group
they have, but I'll keep it like that for now.

str=$( pvscan )

hd()
{
        hd=$( echo "$str" | grep "$1" | head -n 1 | awk '{print $2}' )
        echo ${hd//[0-9]/}
}

ln -s $( hd "weird " ) /dev/hd1
ln -s $( hd "weird2" ) /dev/hd2
ln -s $( hd "weird3" ) /dev/hd3
ln -s $( hd "pata1"  ) /dev/hd4


        Wonko

Reply via email to