CentOS iSCSI
iSCSI udev fun with RHEL 5
Posted by Codafoo
on Wednesday, October 10
Configuring Redhat Enterprise Linux 5 with iSCSI is pretty straightforward. However, there is a critical problem with the configuration, non-conforming assignment of scsi drives across different systems.
You'll need to configure udev if you need consistent naming conventions for something like Xen live migrations.
- Add a new rule for iscsi in /etc/udev/rules.d/:
#iscsi.rules
#below should all be on 1 line
KERNEL=="sd*", BUS=="scsi", PROGRAM="/lib/udev/iscsidev.sh %b", SYMLINK+="iscsi/%c{1}/lun%c{2}/part%n"
- Add the iscsidev.sh shell script to /lib/udev/
#!/bin/sh
#iscsidev.sh
BUS=${1}
HOST=${BUS%%:*}
LUN=`echo ${BUS} | cut -d":" -f4`
file="/sys/class/scsi_host/host${HOST}/device/session*/iscsi_session*/targetname"
target_name=`echo $(cat ${file}) | cut -d":" -f2`
if [ -z "${target_name}" ]; then
exit 1
fi
echo "${target_name} ${LUN}"
3. Make sure /lib/udev/iscsidev.sh is executable:
chmod a+x /lib/udev/iscsidev.sh
4. Restart your iscsi device!
/etc/init.d/iscsi restart
#Now you should have consistent names found in /dev/iscsi/
# find /dev/iscsi
/dev/iscsi
/dev/iscsi/storevault1
/dev/iscsi/storevault1/lun2
/dev/iscsi/storevault1/lun2/part
/dev/iscsi/storevault1/lun1
/dev/iscsi/storevault1/lun1/part2
/dev/iscsi/storevault1/lun1/part1
/dev/iscsi/storevault1/lun1/part
page_revision: 0, last_edited: 1211898534|%e %b %Y, %H:%M %Z (%O ago)





