I trawled Google for a fair amount of time trying to figure out how to rescan the SCSI bus.
Here’s the scenario. You have a server that connects to a tape drive via a fiber channel network (using FC switches).
The server loses connectivity through the fiber channel network to the tape drive momentarily.
As a result the server looses access to the tape drive. After the failure the fiber channel network comes back up.
However the server is showing blank device entries in it’s lsscsi out put. The luns and the host entries are there, but it’s not being assigned a /dev/st0 device node.
You check another server connected to the fiber channel network and it can see the tape drive, so that means the fiber channel network is ok.
What to do? This is actually a Fiber Channel controller issue and not really the SCSI controllers fault.
Reading up about SCSI, I found that a SCSI rescan only picks up new devices, it won’t “reconnect” to devices that have failed. So in the case above the SCSI rescan won’t help me. Also the problem is also deeper than just SCSI, so you need to also issue a rescan on the Fiber Channel HBA.
In Theory, rescan the Fiber Channel HBA, after that the device comes back up, rescan SCSI and the LUN, Host entries are correct and your device becomes accessible again.
If the device is still hanging around in lsscsi but has no device node entry (/dev/st0) then you may have to delete the entries manually before issuing the Fiber Channel and SCSI rescan.
Here’s the process to start a rescan. This should work in SLES 10 and CentOS 5.
host$num is the number of the Fiber Channel controller. This is the first number that shows up when you run and lsscsi.|
E.G
[7:0:10:0] mediumx STK SL500 1126 -
So the host$num is host7
# cd /sys/class/fc_host/host$num
# echo 1 > issue_lip
The Fiber Channel controller will now rescan the network. Wait about 15 seconds. You should see some entries in /var/log/messages.
Next you need to rescan SCSI.
# cd /sys/class/scsi_host/host$num
Host$num is the number of the SCSI controller. If you run a “cat proc_name” and get “<NULL>” then it’s not a valid SCSI controller. The “cat proc_name” should return something other than “<NULL>”.
# echo “- – - ” > scan
This should rescan the SCSI bus and presto, your device returns
