Online LUN detection in RHEL 5
Things have changed much post migration from RHEL 4 to RHEL 5. In 4, we can easily detect the luns by sending an echo command to rescan the HBA adapter driver, however in 5 this does not work or shall I say it is not available. But still I feel their should be some mechanism to query either the hba driver or the SCSI mid layer.
I have tried the following on RHEL 5 to scan for the new luns and found it to work, but do not try it on production.
# for name in `ls /sys/class/scsi_device`; do
echo 1 > /sys/class/scsi_device/$name/device/rescan ;done
Or use blockdev per device
# for name in `ls /dev`; do
blockdev --rereadpt /dev/$name ;done
echo 1 > /sys/class/scsi_device/$name/device/rescan ;done
Or use blockdev per device
# for name in `ls /dev`; do
blockdev --rereadpt /dev/$name ;done
Got a script to do the same:
####### Script starts ########
#!/bin/bash
FDBf=/tmp/fdbf
FDAf=/tmp/fdaf
PBf=/tmp/pbf
PAf=/tmp/paf
#before fdisk output
fdisk -ll | egrep Disk | egrep -v emcpower >> $FDBf
#before powerpath
powermt display dev=all | egrep Pseudo >> $PBf
Lun=$1
for name in `ls /sys/class/fc_transport/ | awk -Ft '{print $3}'`; do
Host=`echo $name | awk -F: '{print $1}'`
Ctl=`echo $name | awk -F: '{print $2}'`
Tar=`echo $name | awk -F: '{print $3}'`
echo "$Ctl $Tar $Lun" > /sys/class/scsi_host/host${Host}/scan
done
#After fdisk output
fdisk -ll | egrep Disk | egrep -v emcpower >> $FDAf
diff $FDAf $FDBf
powermt config
#After powerpath
powermt display dev=all | egrep Pseudo >> $PAf
diff $PAf $PBf
exit
###### Script end ##########
Comments
Post a Comment