Hot Adding a VMDK to Linux Without Reboot (Rescan SCSI Bus)

With virtualization, we have opened up some possibilities that was not possible on some servers,  one of those possibilities is to add a hard disk on the fly to any server. This is especially great when you need to add more storage to a file server / backup / etc..

Now don't get me wrong, I know we could have done this before. But there was a cost barrier to that kind of solution with specific hardware, virtualization enables this on all VMs.

In windows, when adding a new virtual hard drive, the system will just detect the change and publish it in my computer (although sometimes a rescan in the server manager is required). In linux, its not that straight forward when we are dealing with a GUI-less server. 

Thankfully there is a command that will rescan the SCSI bus and detect new hard drives:

echo "- - -" > /sys/class/scsi_host/host0/scan

this will detect new hard drives and display them in /dev

After that, mount the new drives to whatever mount point you choose.

Before Rescanning the bus, only 2 hard drives exist (sda, and sdb)

Before Rescanning the bus, only 2 hard drives exist (sda, and sdb)

After running the command, sdc is now visible to the system.

After running the command, sdc is now visible to the system.