udev device-persistence problem

Mikkel L. Ellertson mikkel at infinity-ltd.com
Tue Dec 5 15:28:01 UTC 2006


T. Horsnell wrote:
>> T. Horsnell wrote:
>>> FC6 - kernel 2.6.18-1.2798.fc6 - udev-095-14
>>>
>>> I'm trying to develop some rules to give me device-name
>>> persistence on my SCSI disks. I have a couple of test rules:
>>>
>>> BUS=="scsi", PROGRAM="/sbin/scsi_id -g -u"
>>> RESULT=="20004cffffe0e0976", NAME="dsk0_%n", OWNER="root", GROUP="root", MODE="0700"
>>> RESULT=="SSEAGATE_ST336807LC_3KT0CTTM00007530YTR2", NAME="dsk1_%n", OWNER="root", GROUP="root", MODE="0700"
>>>
>>> With these rules disabled, I get:
>>>
>> <-------------[ SNIP ]--------------------------->
>>
>>
>>> Why have I got both sd devices and dsk devices?
>>> And what is the second line?
>>> Why have I got an entry:
>>> crw------- 1 root root 21,  0 Nov 28 11:45 /dev/dsk0_0
>>>
>>> This looks like a generic device, but if so, why only one?
>>> And where are the normal sg devices?
>>>
>>>
>> <-------------[ SNIP ]--------------------------->
>>
>>>
>>> Is this all as expected?
>>> Am I going to be screwed later on if I need to do something
>>> that requires a generic SCSI device for a particular disk?
>>> Why do I still get /dev/sd* entries?
>>> Any clues anyone?
>>>
>>> Cheers,
>>> Terry.
>>>
>>>
>> Unless you use OPTIONS="last_rule" in your rule, both your rule and
>> the default rule will be used. So you will end up with both sets of
>> device entries.
>>
>> Now, as for the order problem, you may need to change the program
>>from "/sbin/scsi_id -g -u" to "/sbin/scsi_id -d %N -s %p" or
>> "/sbin/scsi_id -d %N -s %p -g -u". What I suspect is happening is
>> that scsi_id is not returning what you expect. From the scsi_id man
>> page:
>>
>> scsi_id  is  one  of  the  tools used in the "Linux Persistent
>> Device Names" scheme that creates persistent device links in
>> /dev/disk. It is called with the -x option which will print all
>> values in a defined format to let udev import it into its own
>> environment for later event processing.
>>
>> An  example custom udev rule using scsi_id, that will name a block
>> device and any partitions for the device matching the scsi_id output
>> of 312345:
>>
>> BUS=="scsi", PROGRAM=="/sbin/scsi_id -d %N -s %p", RESULT=="312345",
>> NAME="disk%n"
>>
> 
> Thanks for this advice Mikkel, but so far it doesnt make any difference.
> Here's my modified ruleset:
> 
> BUS=="scsi", PROGRAM="/sbin/scsi_id -d %N -s %p -g -u"
> RESULT=="20004cffffe0e0976", NAME="dsk0_%n", OWNER="root", GROUP="root", MODE="0700", OPTIONS="last_rule"
> RESULT=="SSEAGATE_ST336807LC_3KT0CTTM00007530YTR2", NAME="dsk1_%n", OWNER="root", GROUP="root", MODE="0700", OPTI$
> 
> And here's the results:
> (There is actually a small difference. I now dont have a block-device
> for dsk0, partition 1. /dev/disk0_1 has become a character device.)
> 
Where did you put your rules? If the file with your rules comes
after the default rules, then both sets of rules will get used. I am
not sure why the first partition is being set as a character device.
It doesn't make sense, especially with /dev/sda1 correctly created
as a block device.

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