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

If you found this post useful and would like to help support this site - and get something for yourself - sign up for any of the services listed below through the provided links.

The following links are part of affiliate programs, and I will receive a referral payment from any of the services you sign-up for.

  • Get Faster Shipping: About to order some stuff on Amazon but want to get more value out of the money you would normally pay for shipping? Sign-up for a free, 30-day trial of Amazon Prime to get free two-day shipping, access to thousands of movies and TV shows, and more.
  • Start Investing Now: Looking to start investing some of your saved income? Get started by opening an account with Webull, where upon sign-up and opening a brokerage account with an initial deposit of $100 or more you will receive free stock(s). The promotions are always changing, so be sure to click the link to see the latest.

Thanks for reading and take care.