Virtual Hard Disks (VHDs) in Windows Virtual PC

Virtual Hard Disks (VHDs) in Windows Virtual PC

  • Comments 13
  • Likes

What are VHDs?

Virtual Hard Disks (abbreviated to VHDs) are files on the physical machine that store the hard disk contents of a Virtual Machine (VM). Each VHD file is treated as a separate hard disk by Windows® Virtual PC (WVPC).

The Virtual Hard Disk file format is an open standard. For the curious, the specifications of VHD file format can be found here: As can be seen, the format is quite straightforward and is completely agnostic to the virtualization technology in use and to the host and guest operating systems.

WVPC, Windows® XP Mode, Microsoft Hyper-V®, Virtual PC 2007® and other Microsoft’s virtualization solutions use the VHD format.

Types of VHDs

There are three types of Virtual Hard Disks: fixed disks, dynamically expanding disks and differencing disks.

Fixed disks take up all the space that the VHD is allowed to have up front. For instance, if you create a fixed disk of size 64GB, the VHD file will occupy 64GB of hard disk space right from the time of creation, and its size will never vary.

Dynamically expanding disks (also called sparse disks) increase in size to take up space as required. The size specified when creating a dynamically expanding disk indicates the maximum size that the disk is allowed to grow to. For instance, if you create a dynamically expanding disk of size 64GB, the VHD file might initially occupy only a few KB. It will slowly grow upon usage to occupy up to the maximum size specified (64GB). Note however, that the guest operating system will be made to believe it has the full 64GB right from the start.

Differencing disks are a little different. They merely save the changes to the VHD relative to a base disk. Differencing disks are always linked to a dynamically expanding disk or a fixed disk, either directly or through one or more other differencing disks. To understand differencing disks, let us say you create a fixed disk with Windows® XP installed on it. Now if you create a differencing disk and install Microsoft Office® on this, the differencing disk will contain mainly* the content of the hard disk locations changed by the installation of Microsoft Office®, which will be the locations containing the new files and any modifications to existing files.

* I say “mainly” since the operating system will make changes to the hard disk too, as part of its regular operation (writing to the page file, for instance).

To illustrate this point, take a look at the figure below. There are two VMs using two differencing disks that branch from the same base disk.

Fig. 1

Figure 1. Two VMs on a single host with their Differencing disks sharing the same Base disk

The changes made by VM#1 are saved in its differencing disk (depicted as orange blocks) and the changes made by VM#2 are saved in VM#2’s differencing disk (depicted as green blocks). Wherever there is no data in the differencing disk (i.e., a blank space between the orange blocks), the data will be automatically fetched from the base disk. Thus, VM#1 will see the resultant hard disk as a mix of orange and blue blocks. Neither VM#1 nor VM#2 will be able to see the changes made by the other since these changes are on different differencing disks, and both think they have their own copy of the base disk.

The base reference disk is called the “parent” of the differencing disk, and the differencing disk is called its “child”. As you might have guessed, a differencing disk is unusable without the parent disk. What’s more, any change made to the parent will potentially invalidate the child since the reference file is now different. This is why it is recommended to choose a base parent disk and mark it “read-only” for good.

And what’s the size of the differencing disk, you ask? Well, the differencing disk grows in size as required, and inherits the maximum size from its parent disk.

Using VHDs

Needless to say, all types of VHDs will have the “.vhd” extension. The maximum size of the VHDs supported by Windows Virtual PC is 127GB.

Dynamically expanding disks and differencing disks are by far the most commonly used VHD types.

The biggest advantage of differencing disks is that you can have as many child disks as you like from a single parent disk. So if you need 5 virtual machines with Windows® XP with each configured differently, you can simply create a single sparse/fixed VHD with Windows® XP installed on it and then create 5 differencing disks from this. So that’s saving 4 times the space needed to install Windows® XP!

Indeed, this is the approach used in Windows® XP Mode! Well, let me explain that in detail.

VHDs and Windows XP Mode

When a user installs the Windows® XP Mode package, a dynamically expanding VHD is placed on the system. This is the base VHD, which contains a sys-prepped copy of Windows XP SP3®. The base VHD has already been marked read-only, and what’s more, it’s permissions have been set in such a way that only TrustedInstaller can make changes to it (and the only change TrustedInstaller will make is to remove the file on uninstall). This takes care of having a pristine base VHD that won’t be modified (Figure 2).

When you click on the “Windows XP Mode” link on the start menu after installing the VHD, VPC detects that the VHD has been installed and launches a wizard that takes basic information needed to create the VM. As you can see, this wizard is different from the wizard used to create a VM – for starters, this wizard has already decided to create a differencing disk with the Windows XP Mode VHD as the parent; it merely asks you where you want to place the differencing disk.

Each user on the computer will be shown this wizard and will have a new differencing disk created for them. This way, every user has access to their personal copy of Windows XP without taking up extra space for the Windows XP install.

Fig. 2

Figure 2. Different VMs sharing the same parent VHD in Windows® XP Mode 

This above example is a typical use-case for differencing disks. You can have a similar setup on your machine(s) with Windows® Vista and/or Windows® 7 VMs too. Of course, it is strongly advised that you optimize the base VHD before calling it pristine and marking it read-only. Ah, we haven’t discussed VHD optimizations yet, have we? Well, considering that topic is big enough to merit its own post, I’ll save that for another day. Stay tuned for more on VHDs!

Thayu Ramaiah


Microsoft Virtualization Team

  • This saves space initially, but as the differencing disks become more different from the parent won't they increase in size a lot? A diff disk that's been in use for a long time will have duplicated most of the blocks from the parent, so diff + parent will take up more space than just a single dynamic disk would.

    Also, every virtual disk read or write will have to access the child disk and often the parent disk too so does that not have a big performance impact?

  • I note that you say the base VHD is sys-prepped, so presumably each user's (differenced) virtual machine aquires a different SID? Does this cause any complications with accessing domain resources? - as there will be multiple images with presumably the same machine name (in the XP machine), but different SIDs.

    Or does sticking to Shared networking (NAT) make all this a non-issue?

  • Will the VHDs we made with VPC 2007 work with the new WVPC?

  • @Neil:

    Theoretically, yes - diff + parent becoming bigger would happen eventually. However, for most users, that would take a very long time indeed. In case that ever happens, the user can choose to merge the differencing disk and the parent (into a new disk, if others use the parent disk as well).

    You can always merge to a new disk of the base disk's type when you feel the advantages offered by differencing disks are not needed any longer.


    Each XP machine will also be assigned a randomly generated name as part of the XP Mode setup process.


    Yes, the VHDs made with VPC2007 will be usable with WVPC. Please take care to install the Integration Components of WVPC though.

  • Sounds like you have made the computer that needs to run certain programs in XP "virtually" unusable for all but the professional IT person which lets out "virtually" all of us computer "users" who don't care to become technical geeks.

    Is it back to pen and pencil?

  • @Dave:

    You don't have to become a technical geek to use XP Mode! :)

    If you need XP Mode to run certain old apps, just download and install the required files from

    Once you've installed the required files, you just need to click on the "Windows XP Mode" link on the start menu and provide inputs as required. All the complexity is hidden from you.

    If it was this post that gave you such an impression, that would be because this post was meant for those who would like to know more/delve deeper into the technical details.

  • After installing XP mode, I, indeed have two VHD files - the read-only one(base), dated 9.13.09 and the writable in my \apps\local directory. I was surprised to see that they were roughly of an equal size, so I mounted both for inspection. Along with swap file, I also saw i386 directory, Windows directory  - in other words data that I did not expect to see on the diff disk. Am I not properly understanding the diff disks behavior or is there some control over what is being included into diff vs retained on the parent?

  • @Boris:

    When you mount the diff disk, remember that the diff disk shows the combination of both its data and the parent's data. So it is to be expected that it shows files from the parent as well (such as the i386 and Windows directories)...

    However, I am surprised that your diff disk has grown to almost the size of the parent in such a short while! :)

    If you think you don't have that much data in your VM, try using the compact option for the VHD - please note that you should NOT use the precompact tool for differencing disks. Simply open settings for the XP Mode VM and click on the "Compact" button on the hard disk page. You will first need to shutdown the VM though.

  • why does the virutal disk wizard take so long to convert to dymanic?

  • Hi,

    I'm a first time user of Windows 7 and I have a few programs that will need to run in XP mode.  I'm currently downloading and getting ready to install the programs listed on and wondered after I've installed these, are there any precautions I should take before/after I've installed these?

    I'm concerned I might miss some important setting, or even not recognize that a particular setting or checkbox might be required.  Is there some advice anyone might give on this subject?  I really don't have the time to back track.

  • Hi i downloaded the vhd for windows xp mode base...the vhd after the downloading was complete was a read only file due to which it does not boot from virtual pc  .. i tried unchecking the read only button nut it says i dont have administrator rights but i have signed in on an administrator account only....

  • I have created a backup of my entire computer with symantech backup exec system recovery. Converted the vdi file to vhd and from there everything goes haywire. I got the windows virtual pc and update running. and downloaded xp mode. that works. but why wont it recognice my own created vhd file. I'm aware about the max of 127gb and the 41gb in fixed disk. I even tried installing a new virtal pc with a windows 7 pro dk 64bit iso. Same file I used to install my computer with. It just says prossesor does not suppors t x64bit.

    Even though thats what I'm running outside the virutal enviorment. My processor is an mobil I7 plrocessor. Please help. Would really like to copy my computer and mess with it in an virtual enviorment

  • Hi

    @Thayu @Boris:

    re. file sizes

    Just for the record, I had Windows XP Mode installed, and had installed an instance of Visual Basic 6, MS Office 2003 and run Windows/Microsoft Update to get all the updates etc. My XP Mode.vhd differencing disk was over 8GB in size compared to the XP Mode Base.vhd of just over 1GB.

    Have just done a fresh install from scratch and while XP Mode Base.vhd is the same size at 1.1GB the diff disk XP Mode.vhd is already 0.9GB - and I haven't even done anything since the installation!!

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment