Question: What does “Dynamically expanding virtual hard disk” mean to you?
For some reason, while setting up a development machine in Virtual PC, I had this thought that “dynamically expanding” meant that the disk would start out at a specified size, and expand as needed. However, it’s the opposite. A “dynamically expanding” disk starts off small, and expands to the specified size. So needless to say, 10Gbs wasn’t enough to install Visual Studio 2008 (90 day trial), SQL Express 2005 and 2008, plus the service packs and Windows’ Updates.
What VHD Resizer does in a nutshell, is it creates a new VHD of the size that you want, and then copies your existing partition into it. However, because it copies the partition itself, and not the files, you’ll have a partition in the new drive that’s exactly the same as the previous one. But, if you look in your Disk Management in the Administrative tools of the Control Panel, you will also see some unpartitioned space.
In some of the forums that I read, the users mentioned getting a 3rd party partitioning tool, such as Partition Magic to resize your partition. There is an easier and cheaper way though.
Windows comes with a tool called DiskPart, which can be ran from the command line, and one of it’s many abilities is to expand a partition.
Step 1: Get VHD Resizer
VHD Resizer is a free tool, which can be found at http://vmtoolkit.com/files/folders/converters/entry87.aspx. Unfortunately, for reasons that make no sense to me, you must register first before you can download. After you download and extract the setup, install and then run it.
Step 2: Resize the VHD
Once you have Resizer running, select the source VHD to resize and the destination. Next, specify the size to resize to, which will be larger than the current size.
Step 3: Run and Wait
It will take a while to create the new VHD, so go do something productive, or take a quick nap.
Step 4: Attach the Drive to your VPC
For some people, the drive that they are expanding will be a second drive in their VPC. For others like myself, the main C drive will the one to expand. DiskPart will not allow you to resize the drive that you used to boot up with. So for either way, you must attach the new drive as a second drive in VPC.
What I did, was use the original source drive as my main boot up drive, and attached the destination drive as my second drive.
Step 5: Using DiskPart
Once you get your VPC up and running, load up the Command Prompt and type in “diskpart”.
If you get an error that says something like “The disk management services could not complete the operation”, wait a few seconds and try again.
Once you get DISKPART>, type in “list volume“, which will list off all of the volumes on your VPC.
Next figure out which is the volume that you want to resize. Since my VPC has a C drive and two DVD drives, the one that I wanted was the F drive, or Volume 3.
Now type in “select volume #“. In my case I typed in “select volume 3“.
If it comes back and tells you that “Volume # is the selected volume“, then type in “extend“.
After it tells you that it successfully extended the volume, type in “list volume” once again. You should now (hopefully) notice that the selected volume is larger.
And there you have it. If you were expanding your boot drive, you will have to shut down and attach the new resized drive as your main drive.