[TriLUG] [Fwd: A presentation or meeting]

Jason Tower jtower at cerient.net
Tue Mar 13 10:59:23 EDT 2007


-------- Original Message --------

Hi Jason,

I was the one at your talk the other night that asked about multiple iSCSI
devices and their seemingly indeterminate device naming on the initiator
(depends on the order in which they are discovered).

Just an FYI that I figured out how to guarantee their naming with a udev rule,
and I haven't seen this explained anywhere else on the net:

Normal SCSI disk:

[root at node-1 ~]# scsi_id -g -x -s /block/sda
ID_VENDOR=ATA
ID_MODEL=ST340014AS
ID_REVISION=8.05
ID_SERIAL=SATA_ST340014AS_3JX8LTAT
ID_TYPE=disk
ID_BUS=scsi

iSCSI disk:

[root at node-1 ~]# scsi_id -g -x -s /block/sdb
ID_VENDOR=IET
ID_MODEL=VIRTUAL-DISK
ID_REVISION=0
ID_SERIAL=149455400000000000000000008000000c60300000d000000
ID_TYPE=disk
ID_BUS=scsi

Or, much more brief (without the -x):

[root at node-1 ~]# scsi_id -g -s /block/sdb
149455400000000000000000008000000c60300000d000000

So a valid udev rule (lets call it: /etc/udev/rules.d/75-iscsi.rules) would be
(all on one line):

KERNEL=="sd[a-z][1-9]", PROGRAM=="scsi_id -g -s %p",
RESULT=="149455400000000000000000008000000c60300000d000000",
SYMLINK+="iscsi1"

Which says, run the PROGRAM "scsi_id -g -s" on any SCSI disk assigned the name
"sd[a-z][1-9]" by the KERNEL, and pass it the "sd*" kernel-assigned name as an
argument.  Any SCSI disk whose output of that command matches RESULT should 
have
a symbolic link named "/dev/iscsi1" created to point to the kernel-assigned
device name (whatever that might be).

Then, you can just use /dev/iscsi1 for your filesystem/mounts to guarantee the
same device name, every time, without worrying about the order in which it was
discovered, or what other internal SCSI drives are added to the system.

Works like a champ!

-Marc




More information about the TriLUG mailing list