Virtualization and VMWare Disk Management

Posted in development, virtualization at 12:39 am by wingerz


Virtualization offers a number of nice benefits with a degradation in performance. Lee and I enjoy joking about how running a computer inside a computer is mind-blowing. It’s pretty cool that products like Xen and VMWare work so well.

Our group has been pretty interested in virtualization of late. One of our summer projects involved virtualization. Additionally, we’ve been running our RCP-based research platform demo (which runs on top of our RDF store which runs on top of DB2) off a VMWare image. We configured and started up the components necessary for the demo, then took a snapshot of the system so that whoever is running the demo (usually not one of us) can start things off from the snapshot, do whatever they want, and revert to the beginning state at any point. It’s also nice because we don’t have to worry as much about keeping whatever we’re actively working on demo-able at all times. No matter what’s happened to the code base or the underlying database schema, we can always fire up the demo virtual machine.

One particularly attractive scenario involves running customer applications in virtual machines. If the system goes down, the entire image can be shipped out for problem diagnosis. Various solutions can be attempted and if one happen to fail miserably, the changes can be discarded in favor of another approach.

Today I was setting up an image for some of our summer demos. The image I was working with had a paltry 4GB of pre-allocated disk space. It turns out that increasing the size of the disk is not something that can be done from the VMWare GUI. Fortunately, I found helpful blog post. vmware-vdiskmanager is a command-line utility used to resize disks. Not sure why this stuff hasn’t been incorporated into the GUI, but it’s reasonably easy to work with.

To expand the size of the disk:

vmware-vdiskmanager -x 10gb disk.vmdk

Then I installed Partition Magic on the virtual machine and expanded the partition so that it took up the entire disk.

Then I noticed that my virtual disk files were huge – they took up 10GB even though only about 5GB of the disk space was actually being used. I discovered that this was because the existing image that I started with was pre-allocated, which meant that it was not growable, which meant that the disk files could not be compressed.

To change the disk type (to type 1, growable):

vmware-diskmanager -r disk.vmdk -t 1 new.vmdk

Then I edited the vmx file to point to the newly created new.vmdk.

Defragged the disk to maximize compressibility (this can be done either from the VMWare Tools or from inside the virtual machine), and shrank the disk so that it takes up less room on the host machine.

I started out with an image with Windows XP and a few utilities installed. I added DB2 and Eclipse and set up the RDF store. Then I saved the image so that other people in the group can use it as a base to install their demos.