BackupPC-users

Re: [BackupPC-users] OT: udev rule for persistent removable device naming

2012-04-03 17:57:56
Subject: Re: [BackupPC-users] OT: udev rule for persistent removable device naming
From: Les Mikesell <lesmikesell AT gmail DOT com>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Tue, 3 Apr 2012 16:56:54 -0500
On Tue, Apr 3, 2012 at 3:49 PM, Timothy J Massey <tmassey AT obscorp DOT com> wrote:

My backup servers have a SATA removable drive tray installed in them.  Its purpose is to be a target for BackupPC archvies (among other things) that allows the user to easily swap these.  It is simply a physical tray:  the system sees the drive inside of the tray exactly the same as any other internal SATA drive.

And that's part of my problem.  With RHEL 6, I no longer have consistent (actually, persisitent) device naming.  This system also uses a USB flash drive as its boot drive.  It seems that there is a race condition during bootup.  *Most* of the time, the USB device appears after the SATA drives, but not always.  So, most times my tray shows up as /dev/sdd, but sometimes it shows up as /dev/sde.  As you can imagine, this causes no end of problems with trying to create a script to safely partition and format the drive!

The (AFAIK) proper way to correct this is to create a udev rule to assign the tray device a persistent device name.  However, because it's a removable tray, I can't use something like drive UUID or serial number to do this:  the drive changes.  I can't use SCSI path:  it's the race condition that causes this one to change.  And because sometimes the drive that I insert will be perfectly blank (a new drive), I can't use something like a drive label:  it might not have one!

The only thing I *think* I can use is PCI bus address, and I don't know how reliable that might be.  I don't want some *other* race condition to break things.

Does anyone else have any experience in this regard and might either be able to either point me in a better direction or give me an example of a udev rule that uses PCI address?  I've Googled, but everything I can find uses things like drive ID or label.  I can't find a single example with PCI bus address (DEVPATH).


Personally, I'd never trust a script to automatically format a disk just because it is inserted in a certain carrier.  Maybe something like  making a small permanent partition with a label or UUID would let you detect it and figure out the base device if you really have to format different/larger partition on it in a script.  The PCI bus address shouldn't change unless you move controller cards around, though.

--
   Les Mikesell
     lesmikesell AT gmail DOT com

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/