Assign persistent names to iSCSI devices using udev in Red Hat 5
Here is a quick howto on how to create name persistentcy on iSCSI devices which are used in a Logical Volume setup under RedHat 5. ( This might be slidely different on other distributions of Linux )
First off we need the unique identifier (WWID) of the devices we like to map :
[root@db02 rules.d]# scsi_id -g -u -s /block/sdc
36000eb3cb6c2beee0000000000014asd
[root@db02 rules.d]# scsi_id -g -u -s /block/sdb
36000eb3cb6c2beee0000000000014a21
vi /etc/udev/rules.d/20-names.rules
# udev RMAN iSCSI volume KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000eb3cb6c2beee0000000000014asd", SYMLINK+="rman%n" # udev ORACLE iSCSI volume KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000eb3cb6c2beee0000000000014a21", SYMLINK+="oracle%n"
This will create device names under /dev using the names rman[1-9] en oracle[1-9].
lrwxrwxrwx 1 root root 3 Mar 12 11:20 rman -> sdc
brw-r----- 1 root disk 8, 16 Mar 12 11:20 sdb
lrwxrwxrwx 1 root root 3 Mar 12 11:20 oracle -> sdb
brw-r----- 1 root disk 8, 33 Mar 12 11:20 sdc1
lrwxrwxrwx 1 root root 4 Mar 12 11:20 rman1 -> sdc1
brw-r----- 1 root disk 8, 17 Mar 12 11:20 sdb1
lrwxrwxrwx 1 root root 4 Mar 12 11:20 oracle1 -> sdb1
When using this setup with LVM ( Logical Volume Manager ) , you can see the result straight away :
[root@db02 dev]# pvscan
PV /dev/rman1 VG RMAN lvm2 [100.00 GB / 0 free]
PV /dev/oracle1 VG Oracle lvm2 [100.00 GB / 0 GB free]
Total: 3 [200.00 GB] / in use: 2 [200.0 GB] / in no VG: 0 [0 ]
After this , make sure that every boot time mount is carrying the _netdev option as this device can only be mounted once both network and iscsi is up.
By setting this option, the mount it pro spooned untill the network is started.
/dev/Oracle/u00 /u00 ext3 _netdev 1 2
/dev/Oracle/u01 /u01 ext3 _netdev 1 2
/dev/Oracle/u02 /u02 ext3 _netdev 1 2
/dev/Oracle/u03 /u03 ext3 _netdev 1 2
/dev/RMAN/u04 /u04 ext3 _netdev 1 2

Comments are closed.