Debian/Ubuntu Tips and Tricks


Debian/Ubuntu Tips and Tricks

How-To: Rescan a SCSI bus without Rebooting

Posted by chantra on December 12th, 2009

When you hotplug a hard drive in a virtual machine, the drive do not show in fdisk -l output until you reboot your VM.
In order to get the drive to appear, the SCSI bus need to be rescanned.

The rescan will be triggered through sysfs pseudo filesystem.

First of all get root access and check what host is available:

# ls /sys/class/scsi_host
host0 host1 host2 host3

Pick up the one (here host2 is taken) that match where the drive is and run:

# echo "- - -" > /sys/class/scsi_host/host2/scan

That is 3 "-" separated by a space

Now, you should be able to see the drive when running:

# fdisk -l

4 Responses to “How-To: Rescan a SCSI bus without Rebooting”

  1. Thanks for the tip. But please fix those "smart" quotes and dashes from the echo command!

    INCORRECT: echo “- – -”
    CORRECT: echo "- - -"

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>