How-To: Rescan a SCSI bus without Rebooting

less than 1 minute read

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