public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alex Schuster <wonko@wonkology.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Udev rules for identical hard drives
Date: Thu, 2 Aug 2012 02:42:36 +0200	[thread overview]
Message-ID: <20120802024236.0c12da7c@weird.wonkology.org> (raw)
In-Reply-To: <CADPrc83viVv-+vPma99PYbbZ1OcY05GVbqodWM_EtPPsy=EtTQ@mail.gmail.com>

Canek Peláez Valdés writes:

> On Wed, Aug 1, 2012 at 6:59 PM, Canek Peláez Valdés <caneko@gmail.com>
> wrote:
> > On Wed, Aug 1, 2012 at 6:34 PM, Alex Schuster <wonko@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	other threads:[~2012-08-02  0:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 23:34 [gentoo-user] Udev rules for identical hard drives Alex Schuster
2012-08-01 23:59 ` Canek Peláez Valdés
2012-08-02  0:01   ` Canek Peláez Valdés
2012-08-02  0:42     ` Alex Schuster [this message]
2012-08-02  0:53       ` Canek Peláez Valdés
2012-08-02  9:20         ` Alex Schuster
2012-08-02 10:38           ` Alex Schuster
2012-08-02 13:11             ` Mark Knecht
2012-08-02 15:02               ` Alex Schuster
2012-08-02 15:50                 ` Dale
2012-08-02 18:29                   ` Alex Schuster
2012-08-03  6:40                     ` Dale
2012-08-03 15:31                       ` Paul Hartman
2012-08-04  5:50                         ` Dale
2012-08-02 15:50                 ` Mark Knecht
2012-08-02 17:43                   ` Peter Humphrey
2012-08-02 18:28                     ` Mark Knecht
2012-08-02 18:47                   ` Alex Schuster
2012-08-02 16:59 ` Walter Dnes
2012-08-02 17:43   ` Alex Schuster
2012-08-02 18:57     ` Neil Bothwick
2012-08-02 18:55   ` Neil Bothwick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120802024236.0c12da7c@weird.wonkology.org \
    --to=wonko@wonkology.org \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox