Labels

Wednesday, 23 March 2011

How to dynamically scan/add/remove/offline LUNs in Linux running 2.6 kernel

Scanning for new LUNs

echo 1 > /sys/class/fc_host/host0/issue_lip
echo 1 > /sys/class/fc_host/host1/issue_lip
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan

From RHEL5.4, RedHat has provided a script to scan all the SCSI buses

/usr/bin/rescan-scsi-bus.sh


Removing a path or LUN from the kernel device tree

echo 1 > /sys/block/sdX/device/delete

Take a path offline

echo offline > /sys/block/sda/device/state

If the LUN size is changed at the storage level, the following will rescan the LUN
and update the kernel with the new size

echo 1 > /sys/block/sdX/device/rescan

No comments:

Post a Comment