I have been testing methods for adding space to an Ubuntu Server guest running on VMware. I have setup the server using LVM so I can add physical disks to to the LVM group and expand the logical volume on the system without having to shut it down.

What I am testing right now and having trouble with is rather than adding a second virtual disk, I extended the existing virtual disk using the VMware client and it appears that it worked, but I cannot figure out how to get Ubuntu server to recognize the additional space without a reboot. I have tried rescanning the scsi hosts using the command below as I would in order to add the 2nd virtual hard disk, but that doesn't appear to do anything.

Command to scan for added hard drive: echo "- - -" > /sys/class/scsi_host/host2/scan

Any ideas? I am trying to figure out if this is possible so I don't have to keep adding multiple virtual hard drives every time I need more space and instead just make the existing drive bigger.

Thanks in advance for any help!


So just because it's a virtual machine doesn't mean it behaves differently from a physical server, hotplug is hotplug. If you have indeed added the device to the VM, and you've performed a rescan of the correct bus, then the drive should come up. First lets start with how to verify that the drive is there.

~$ sudo lshw -short -c disk
H/W path           Device       Class          Description
/0/100/1f.2/0      /dev/sda     disk           128GB TOSHIBA THNS128G
/0/100/1f.2/1      /dev/cdrom1  disk           DVDRAM GT30N

Note that I emphasized which bus to scan. The way Linux handles SATA is to represent each LINK as a scsi_host, so you can't just scan any old host, you have to scan the right one where your drive is attached. A little shell scripting will help here.

for i in `ls $hosts`;
echo "- - -" > ${hosts}/${i}/scan

Wait a few moments, then verify the disk is there, and then pvcreate and vgscan just as you normally would. That VMware didn't generate a hotplug event is their problem, I don't know how they implement that. QEMU assigns a PCI device per disk and piggy backs on that hotplug mechanism, no additional probing required. You should really consult the vmware documentation on guest management...


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.