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

Fri Apr 1 11:41:40 UTC 2011
Robert Heller <heller at deepsoft.com>

At Fri, 1 Apr 2011 11:05:35 +0100 CentOS mailing list <centos at centos.org> wrote:

> 
> The reason for the udev hotplug rule is simply for the purpose of mounting removable devices as read-only.  If udev is left to its devices, everything plugged up is read-write which is verboten in this application.  Unfortunately, there seems to be no way (i've found) to distinguish, at device/bus level, between a system HDD, a hardware RAID volume and an eSATA device and handle the eSATA device uniquely from others.  All eSATA and USB devices _must_ mount read-only.  If everything is lined up at boot, sda and sdb are camped via fstab and udev deals with sdc and above, mounting what are known to be removable devices as r/o.  Shotgun, i know, but there is no way of knowing in advance what devices the system (er, appliance) will see.
> 
> tangled, huh?

Does this give you a clue (this is a rule I use for my thumb drive,
which is a vfat file system, and thus cannot have a LABEL'd file system):

gollum.deepsoft.com% cat /etc/udev/rules.d/10-local.rules               
KERNEL=="sd[a-z]*", BUS=="scsi", SYSFS{device/vendor}=="Kingston", NAME="thumb"

Hint: the 'brand' of thumb drive I have is Kingston and == can be
replaced with !=.

In your special mount read-only hot plug rule, you just need a
SYSFS{device/vendor}!="3ware" (or whatever the vendor of the RAID array
shows up as -- look in /sys/block/sd<mumble>/device/vendor)
> 
> thanks
> 
> - csawyer
> 
> Robert Heller heller at deepsoft.com
> Thu Mar 31 14:20:55 EDT 2011
> 
>     Previous message: [CentOS] CentOS Digest, Vol 74, Issue 31
>     Next message: [CentOS] figuring out LogVol details for mount
>     Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 
> At Thu, 31 Mar 2011 18:23:00 +0100 CentOS mailing list <centos at centos.org> wrote:
> 
> > 
> > thanks for the reply, Phil
> > 
> > It would, were udev not inserting USB and/or eSATA drives at /dev/sdb1
> > and/or /dev/sdc1 and exposing the array to the udev rule intended to
> > handle only removable devices (at sdc or sdd).  The array then mounts
> > unpredictably in /media/xxx-sdc1 or sdd1 - not what is wanted - depend
> > on how many removable devices are plugged at the time of rebooting. Of
> > course, a single removable device will camp at sdb, which is out of
> > reach of udev so the whole hotplug thing is broken until someone removes
> > all of the devices at site, allowing a clean boot. 
> 
> Do you have some *nonstandard* udev rule for hot plug devices? The
> *standard* hotplug udev rules are not tied to specific ranges of sdXX's
> -- my IDE-based laptop will properly handle a hot plugged USB device at
> /dev/sda for example.
> 
> The hot plug logic should also not mess with not hot pluged devices.  If
> your RAID array is mounted in /etc/fstab (or has a 'noauto' line in
> /etc/fstab with the idea of mounting it manually later or has something
> in automount's config for automounting it), the hot plug system should
> not touch it, no matter what /dev/sdXX it happens to land at, so long as
> you are using volume labels or some such to reference the mountable
> volumes.
> 
> - cal sawyer
>  
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
> 
>                                                                                      

-- 
Robert Heller             -- 978-544-6933 / heller at deepsoft.com
Deepwoods Software        -- http://www.deepsoft.com/
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments