How to Rescan SCSI bus on Linux Centos 7 Without Rebooting
SCSI stands for Small Computer System Interface and is a set of standards for transferring data and connecting devices and computers. Sometimes you make changes to disk devices on your Linux box while online which is even more often nowadays using virtual machines. Sometimes you also add a new disk and do not want to restart your Linux system. Wether you need to add a new disk or increase an existing disk size of your virtual machine, the changes will not be instantly visible from the Linux operating system because you need to rescan SCSI bus on Linux to see the change. It is quite easy to rescan SCSI bus on Linux, you can do it with a simple one line command (depending on the number of SCSI devices you have connected).
Rescan SCSI bus on Linux
Please note that the rescan SCSI bus on Linux does not interrupt operating system operation nor remove any of the disks. Rescanning SCSI bus on Linux with the below procedure will add/freshen devices but not remove them.
sg3_utils package provides the
rescan-scsi-bus.sh script, which can automatically update the logical unit configuration of the host as needed (after a device has been added to the system). The
rescan-scsi-bus.shscript can also perform an
issue_lip on supported devices. For more information about how to use this script, refer to
yum install sg3_utils.
rescan-scsi-bus.shscript, take note of the following known issues:
- A race condition requires that
rescan-scsi-bus.shbe run twice if logical units are mapped for the first time. During the first scan,
LUN0; all other logical units are added in the second scan.
- A bug in the
rescan-scsi-bus.shscript incorrectly executes the functionality for recognizing a change in logical unit size when the
--removeoption is used.
rescan-scsi-bus.shscript does not recognize ISCSI logical unit removals.