From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-user+bounces-140312-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9F99A13800E for <garchives@archives.gentoo.org>; Thu, 2 Aug 2012 00:44:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4E109E030B; Thu, 2 Aug 2012 00:43:58 +0000 (UTC) Received: from mx.virtyou.com (mx.virtyou.com [178.33.32.244]) by pigeon.gentoo.org (Postfix) with ESMTP id BA2ABE072C for <gentoo-user@lists.gentoo.org>; Thu, 2 Aug 2012 00:42:38 +0000 (UTC) Received: from weird.wonkology.org (xdsl-84-44-153-81.netcologne.de [84.44.153.81]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx.virtyou.com (Postfix) with ESMTPSA id C9FDCDC048 for <gentoo-user@lists.gentoo.org>; Thu, 2 Aug 2012 02:42:37 +0200 (CEST) Date: Thu, 2 Aug 2012 02:42:36 +0200 From: Alex Schuster <wonko@wonkology.org> To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Udev rules for identical hard drives Message-ID: <20120802024236.0c12da7c@weird.wonkology.org> In-Reply-To: <CADPrc83viVv-+vPma99PYbbZ1OcY05GVbqodWM_EtPPsy=EtTQ@mail.gmail.com> References: <20120802013404.3c67615a@weird.wonkology.org> <CADPrc80MDOPdykn_G4mZ_DKyw=Rwr4buMbi-vDRZ4ZZu1s84Ew@mail.gmail.com> <CADPrc83viVv-+vPma99PYbbZ1OcY05GVbqodWM_EtPPsy=EtTQ@mail.gmail.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.11; x86_64-pc-linux-gnu) Precedence: bulk List-Post: <mailto:gentoo-user@lists.gentoo.org> List-Help: <mailto:gentoo-user+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-user.gentoo.org> X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 7b382d6a-2592-4c37-8b05-b4b4683b3d35 X-Archives-Hash: 4ffbdc8938e45b817ed4d8bfee6ab2cb Canek Pel=E1ez Vald=E9s writes: > On Wed, Aug 1, 2012 at 6:59 PM, Canek Pel=E1ez Vald=E9s <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=3D$( pvscan ) hd() { hd=3D$( 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