How To Detect a New Hard Disk Without Rebooting VMware Linux Guest

In this how to, I assume you have already added in a new hard disk in your VMware Linux guest machine. You can detect the new hard disk or rescan entire SCSI bus without rebooting the VMware Linux guest. This how to has been tested on VMware ESXi 5.0 and CentOS 5.8 as the Linux guest.

Below image shown is a new hard disk add: -

Below image shown is output of “fdisk -l” before the new hard disk is added: -

Now, once the new hard disk is added, type the magic oneliner command below to detect the new hard disk or rescan the SCSI bus: -

ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done

Below image shown is output of “fdisk -l” after the new hard disk is added and oneliner command above is run: -

You will see a new disk /dev/sdd as above. You can also verify the new hard disk using dmesg output as below: -

About wingloon

I am Linux engineer attempting to decode my knowledge through blogging in the World Wide Web. I will share my knowledge as much as possible about Linux (what I know best) and technology in general to all my readers.