Vmware Linux Guest Add a New Hard Disk Without Rebooting Guest

As a system admin, I need to use additional hard drives for to provide more storage space or to separate system data from user data. This procedure, adding physical block devices to virtualized guests, describes how to add a hard drive on the host to a virtualized guest using VMWare software running Linux as guest.

It is possible to add or remove a SCSI device explicitly, or to re-scan an entire SCSI bus without rebooting a running Linux VM guest. This how to is tested under Vmware Server and Vmware Workstation v6.0 (but should work with older version too). All instructions are tested on RHEL, Fedora, CentOS and Ubuntu Linux guest / hosts operating systems.

Step # 2: Rescan the SCSI Bus to Add a SCSI Device Without rebooting the VM

A rescan can be issued by typing the following command:echo "- - -" > /sys/class/scsi_host/host#/scan fdisk -l tail -f /var/log/message Sample outputs:Fig.01:Linux Vmware Rescan New Scsi Disk Without Reboot Replace host# with actual value such as host0. You can find scsi_host value using the following command:# ls /sys/class/scsi_host Output:

How Do I Delete a Single Device Called /dev/sdc?

In addition to re-scanning the entire bus, a specific device can be added or existing device deleted using the following command:# echo 1 > /sys/block/devName/device/delete # echo 1 > /sys/block/sdc/device/delete

Optional Task: Label the partition

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Your support makes a big difference:

I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft takes a lot of my time and hard work to produce. If everyone who reads nixCraft, who likes it, helps fund it, my future would be more secure. You can donate as little as $1 to support nixCraft:

With VMware and SAN storage devices it is possible to change the disk size. In windows rescan disks updates the new size. The only way I found to notify the OS (linux)that the disk geometry was changed is by rebooting. Is it possible to do this online?

hi vivek Ur updates are really useful for me …I am Fresher now i m using rhel5.0 i forgot the steps to create the repositery can u help me…. In my home i didn’t have internet i used a system as a client i copied all the dvd contents into /var/ftp/pub/Server please help me …

Very nice article! I have a similar situation and this worked quite well.

One question though. When you have a situation like described above, with /dev/sda1, /dev/sdb1 and /dev/sdc1; what happens when you detach /dev/sdb1, so only /dev/hda1 and /dev/hdc1 are left? I’ve experienced earlier that Linux has a way with reshuffeling its device-names after reboot. So I think you can expect /dev/sdc might change to /dev/sdb?