Virtual Disk Options in Windows 7 Virtual PC

This article is one of a list of articles dealing with Windows Virtual PC on Windows 7, and in it I will show you what are the virtual disk options that you can use when building and configuring a VM in Windows Virtual PC.

If you haven’t done so yet, read my article on installing Virtual PC on Windows 7.
When using Virtual PC, there are basically 3 virtual disk options you can use. Unless you want to use the default option which is a dynamically expanding disk, select “Create a virtual disk using advance options” in the VM creation wizard.
create-new-vm-5
After pressing Next, you will be presented with the 3 virtual disk options:
create-new-vm-6
Lets walk through these options and see what’s the difference between them.
Dynamically Expanding Virtual Disk
As a recommendation, if you’re planning to use Windows Virtual PC for its original purpose, that is to run legacy applications that do not work on Windows 7 (most notably – 64-bit version of Windows 7), then using a Dynamically Expanding Virtual Disk, which is the default, is for you. It’ll save you disk space, and while there ARE some performance drawbacks, VPC is not intended for running production-type virtual machines. It’s all about testing, running legacy apps, giving demos and so on.
From a performance point of view, using Dynamically Expanding Virtual Disks is not ideal, and since the VHD files need to grow as more data is added to the virtual disk, there is a very high probability of causing file fragmentation on the host’s physical disk.
Fixed Size Virtual Disk
This is the best option for performance reasons. VHD file has a fixed size, so there is no file fragmentation on the host’s physical disk. However, since size it fixed, you’ll be wasting a lot of disk space. If you plan to have more than one or two VMs, and if you plan to use Fixed Size Virtual Disk with these VMs, you must be prepared for the disk usage penalty.
Differencing Virtual Disk
Unlike a regular Dynamically Expanding Virtual Disk, a Dynamically Expanding Differencing disk uses 2 VHD files. One VHD is the parent disk, and another VHD file that stores all the changes, in a bit level, made since the parent disk has been created.
Differencing Virtual Disks allow multiple users and multiple virtual machines to use the same parent virtual hard disk at the same time. Virtual PC stores any changes to the virtual hard disk in the Differencing Virtual Disks. For example, you can build one instance of a given operating system, configure it as a parent disk, and then create many alterations of the same operating system by simply adding Differencing Virtual Disks that rely on the parent disk.
Using Differencing Virtual Disk is beneficial when you need to create and run a bunch of VMs that are all based on one parent VM. Also, it’s useful for scenarios that require the ability to “go back in time” to previous versions of the VM.
For example, I use this option when I need to run a demo environment for a client, something like having 3 or 4 Windows Server 2003/2008 (sorry, no can do R2, as it’s 64-bit only…), creating an Active Directory lab, setting up Exchange 2003 and so on. Without Differencing Virtual Disks, such a setup would require storing multiple VHD files, one or more for each VM. Since each Windows Server 2003 VM uses a few GB for its system partition, that would mean using a lot of disk space on the host machine.
By using Differencing Virtual Disk, there will be one VHD, a “Master” VHD for the base image of Windows Server 2003 (I’m only using 2003 as an example, you could do this for any supported OS), and a Differencing Virtual Disk for every “Child” VM. The child VMs store their disk changes in a separate file. The combination of parent and child would then become a Windows Server 2003 machine running Active Directory, another running Exchange and so on. This way, having a lot of different children uses a lot less space than having to copy the complete base image each time.
As another example, using Differencing Virtual Disk is cool for scenarios where you only want to test an application on the VM, but want to keep the ability to undo the app’s installation. Also, having a VM that can be used to download files from err… suspicious website or P2P networks, scan them for malware, and even install whatever it is you downloaded might be useful for a lot of people.
It’s worth noting that when using Differencing Virtual Disk, you are no longer allowed to modify or edit the master or parent VHD file. If you do that, all differencing disks will be damaged and you will no longer be able to use them.
Another note is that there is an option to clone a Differencing Virtual Disk (parent + child) into a separate VHD file containing both virtual disks. This way you break the relationship between the parent and child, and now use a totally separate VHD file containing both. The original VHD files will not be affected.
From a performance point of view, Differencing Virtual Disk are not your friend, as they require the reading of many VHD files. One way to make things better is to use NTFS compression on the parent VHD file, making it smaller in size. The idea is that whatever penalty compression brings to the CPU of the host machine, is compensated by the fact that the disk subsystem has less to read, and since the parent VHD is read-only, there is no write penalty.