Udev rules for SATA drives
Mikkel L. Ellertson
mikkel at infinity-ltd.com
Mon Aug 7 17:21:29 UTC 2006
Mike Cisar wrote:
> Hopefully someone can point me in the right direction. Am configuring a new
> server for a client with FC5, this server has 3 removable SATA drives
> (replacing their existing server with 3 removable IDE drives). In their
> original server the primary and secondary master drives (hda and hdc
> respectively) were software raid 1 and the primary master (hdb) was used as
> a backup device.
>
> In the new server the first 3 drives will be software raid 1 (2 drives, 1
> spare). The motherboard has 4 SATA connectors, for the sake of this email I
> will call the drive attached to the first of those connectors drive 1, etc)
> As mentioned in another thread, unfortunately removing one of the drives
> causes the kernel to shuffle the drive assignments up (rather than simply
> leaving a gap as with IDE). IE. normally I will have sda-sdc... if I remove
> the second drive, my goal is to have sda and scd (with sdb missing) instead
> of having sda, sdb as is assigned by default.
>
> I have added the following in 10-local.rules
> BUS=="scsi", ID=="0:0:0:0", DRIVER=="sd", NAME="sda%n"
> BUS=="scsi", ID=="1:0:0:0", DRIVER=="sd", NAME="sdb%n"
> BUS=="scsi", ID=="2:0:0:0", DRIVER=="sd", NAME="sdc%n"
> BUS=="scsi", ID=="3:0:0:0", DRIVER=="sd", NAME="sdd%n"
>
> When booting with only 2 drives (the 2nd removed) the above seems to create
> all the correct nodes and standard symlinks for sda and sdc and I can
> perform operations against sdc as I would expect. Unfortunately the device
> node for sdb is also present, presumably from either the kernel's assignment
> or the default rules.
>
> What can I add to my local rules so that the "stray" sdb node is removed or
> not created as the case may be (and likewise for any of the other 3 drives
> which might for whatever reason be removed from the machine)?
>
> Regards,
>>>>>> Mike <<<<<
>
>
Two things that may help - if your rules come before the default
ones, you can add OPTIONS="last_rule" to your rules to stop the
default rules from being checked. But I do not think that will help
in this case, because the default rules are matching on different
"keys".
The other thing you could try is to change the names from sda%n to
something like raid%n and then configure the RAID driver to use
these names.
What I suspect is happening when you remove the second drive is that
your rules are creating /dev/sda and /dev/sdc, while the default
rules are creating /dev/sdb that is the same hardware as /dev/sdc
that you created. If you removed the third drive, then the forth
would probably end up as both /dev/sdc and /dev/sdd.
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
More information about the fedora-list
mailing list