Extending a virtual hard disk with Windows PE

I tend to do a lot of my development work using virtualisation, usually VMware Server or Workstation. Quite often I build a VM and realise once I start using it that I need more hard disk space. It’s easy enough to slap another virtual disk in and just add another disk, but what if you just want to make the current disk bigger?

I’ve found there’s a way to do this that is quite painless, and is possible with the tools that I use daily – admittedly it doesn’t mean that you use them daily, but maybe you do: WinPE from the Windows Automation Installation Kit (WAIK), and vmware-vdiskmanager.exe which is installed as part of VMware Workstation or Server.

First of all we need to open up cmd.exe and run the following command from within the VMware Workstation/Server folder:

vmware-vdiskmanager.exe -x

In this example, we’re going to extend the hard disk in a 2003 server VM from 8GB to 10GB:
VMware-vdiskmanager.exe Extend Example

Next, we boot the Virtual Machine with a WinPe disk. We’re not going to go into the details of preparing a PE disk now, but the documentation can be found here.

Once the VM has booted into PE, we want to use the diskpart utility.
Windows PE - Diskpart Extend example
As you can see, checking the volumes after the extend shows that we now have 10GB available for use. A reboot back into the guest OS and we’re back in business, and we didn’t even have to break out Partition Magic!

System Center Virtual Machine Manager uses PowerShell

I was talking to a colleague using the beta of SCVMM today, and he commented that it supports PowerShell.

Sure enough, on the Microsoft product page, there’s a link for the Top 10 Benefits of Virtual Machine Manager 2007, and down at number 10 we have:

Windows PowerShell provides rich management and scripting environment

The ability to automate common operations using a command line interface is core to the Virtual Machine Manager. The entire solution is built on the new command line and scripting environment, Windows PowerShell. This enables GUI operations to be quickly exported to PowerShell scripts for customization and automation.

This is great! The list keeps growing. :)