Linux Rescan SCSI Bus
Wednesday, August 22, 2012
Below are three different methods for rescanning SCSI devices that I have tested on RHEL 5 and RHEL 6.
Rescan Specific SCSI Device
This command consistently rescanned the specific SCSI device.
Replace $DEVICE with sda, sdb, sdc, etc.
echo 1 > /sys/block/$DEVICE/device/rescan
Rescan Entire Host SCSI Bus
This command never consistently rescanned the host SCSI bus.
Replace $HOST with the SCSI host you want to scan which could be host0, host1, host2, etc. Typically $HOST is host0.
echo "- - -" > /sys/class/scsi_host/$HOST/scan
The triple dashes, - - -, are wildcards that rescan every channel, every target, and every LUN on the specificed SCSI host.
Rescan Specific SCSI Device (Deprecated)
This command never consistently rescanned the specific SCSI bus and has been deprecated by Red Hat.
The Host:Bus:Target:LUN (0:0:2:0 in this example) may be different for you. Run ls -al /dev/disk/by-path to find it.
echo "scsi remove-single-device 0:0:2:0" > /proc/scsi/scsi echo "scsi add-single-device 0:0:2:0" > /proc/scsi/scsi