[CentOS] Controlling the order of /dev/sdX devices?

Fri Apr 1 17:08:59 UTC 2011
Cal Sawyer <Cal.Sawyer at artsalliancemedia.com>

ack, i can feel my hair greying ... again.  *But*, i do appreciate your insight into the future direction of CentOS device handling.  Having read this, i'm going to bite the bullet and dive into smarting-up my udev rules, feeding a handler script that will decide what to do about what kind of device before blindly executing mounts based on KERNEL values.

Two silly questions:  

1. in udev rule's RUN+-"", can i pass an arbitrary string that's not one of the %tokens? I pass %k %n, of course, but i'd like to tag something to indicate which rule was processed in a downstream script.
2. Will udev, as it develops (i hope), will there be any provision blacklisting/whitelisting devices?

Were it not for the removable-read-only requirement, i'd have been content with HAL doing the work.  It does work well for handling CD/DVDROM discs (the 3rd type of removable we deal with) but doesn't do granular device detection well enough to set read-only for removable media only and a read-only RAID array is not that useful.

many thanks - good weekend, all

- csawyer

-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Lamar Owen
Sent: 01 April 2011 15:19
To: CentOS mailing list
Subject: Re: [CentOS] Controlling the order of /dev/sdX devices?

On Friday, April 01, 2011 09:53:06 am Cal Sawyer wrote:
> Nope, no LVM on the RIAD array.  It just needs to load right after the main LVM so that something removable doesn't wiggle its way in and mess up the device order.

Ok, so the LVM line was for the previous filesystem; it wasn't completely clear from the post.  The LABEL line was clear, though.

> Yes, the suggestion from Robert H looks promising - working on it now.  Did i say i hate udev?  I thought there was going to be a replacement for it at some point?

udev *is* the replacement, and with C6 you're going to find it far earlier in the boot process, inside the initramfs courtesy of dracut.

Like it or not, fixed always-the-same device ids are going away for disk drives in Fedora-derived (and by extension, Red Hat derived) distributions.  udev might seem to be overkill, but it is what it is and it's here to stay, in CentOS-land at least, for as long as C6 is supported.  Might as well bite the bullet and learn how to do what needs to be done in udev.  Once figured out, you might find it more powerful than fixed ids ever were; I don't know, because I've not tried to do things like your situation.

Let us know if the suggeston works, and how well or not well it works.  Your 'read-only for all external drives' situation is unique; note that there are times that I've booted up a box with a removable plugged in, and the removable failed to enumerate at all.  It would only enumerate when it was hotplugged after the kernel systems were up; the particular case is with a USB3 drive and an ExpressCard USB 3 controller on Fedora 14, but I have had the issue with USB 2 devices on previous Fedoras, that might be reflected in C6.
CentOS mailing list
CentOS at centos.org