ThorneLabs

Linux Rescan SCSI Bus

• Updated January 10, 2019


If you have added one to many disks to a Linux server or added partitions to an existing disk and the operating system has not yet recognized them, you might need to rescan the SCSI bus. You could simply reboot the Linux server, but that’s usually not an option for production systems.

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 specified SCSI host.

Rescan Specific SCSI Device (Deprecated)

This command never consistently rescanned the specific SCSI bus, and it has been deprecated by Red Hat.

Host:Bus:Target:LUN (0:0:2:0 in this example) might be different for your system. 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

References