Differencing disks with Virtual PC 2007

I thought it would be a breeze to create a differencing disk with VPC 2007.

I imagined the process to be:

  1. Create a virtual PC to be used as the parent for all images.
  2. Install <Operating System> onto the virtual PC.
  3. Create new virtual PC – create a virtual disk of type “difference”, and point it to the parent as it’s starting point.

Nope – it does not happen that way. It’s quite a convoluted process.

Luckily the folk at petri.co.il have already figured it all out.

Good work with simple instructions that are easy to follow. So easy, in fact, that I have myself a system where I can try out new ideas that are likely to mess up my PC – without messing up my PC.

I can create a new PC in probably less than a minute now. I can then do all the dodgy stuff I would never dream of doing on my own PC, without having to worry about it. Things like opening unverified executables, installing software I intend to use only once, testing a variety of software…


Here is the text from the previously mentioned link (just in case it goes down)

Step #1 – Create and install the base image VM

Without going into great detail here, create a new VM by specifying the name of the VM, the location of the virtual hard disk and the .VMC file, select the type of operating system you’re going to install, and allocate the right amount of memory to the VM. You can read more about creating virtual machines in Microsoft Virtual PC 2007 on my “Creating Virtual Machines with Microsoft Virtual PC 2007” article .

After creating the VM you need to boot it, and install the required operating system on it. The installation process is as smooth as installing the OS on a real computer, and is only a notch slower (based upon your host’s machine hardware specifications.

If the OS requires entry of a CD-Key (or Product Key) – do it. If not (like Windows Vista), you can leave it to a later phase.

Make sure you install all the relevant components. Also, you might want to leave the ISO image for the installation CD available on the network in order to allow for future additions of OS components. In order to keep the virtual disk as small as possible I try not to copy the i386 (or equivalent) installation folder to the VM.

Step #2 – Customize the base image VM

In this step you will want to customize the base image VM as you want it to appear in all subsequent clones of that VM. For instance, install any file, tweak, addition, program, tool or other item that you want to have on ALL the VMs that are based upon this base VM.

If you plan to clone the base VM many times and you plan to have these machines on the same network (for example when creating an Active Directory-based lab of several servers and a few client machines) do NOT activate the base VM!

If all subsequent clones will work independently from one another (for example when creating a lab of one Windows XP Pro SP2 machine that will have several applications installed on it but none will work together at the same time or will not be part of the same AD domain) then you can activate the base VM.

Remember, cloning VMs is like “ghosting” a real machine. You must use SYSPREP in order to create unique SIDs, computer names and other settings for each cloned machine.

Read the Links section for more info on SYSPREP.

Also, note that you should install the VM Additions on the base VM.

Step #3 – Temporarily enable undo disks for the base image VM

Next comes the nice part. After customizing the base image you need to shut down the base VM. Make sure you do NOT perform the following step unless you are 100% sure that the current state of the base VM is EXACTLY like you want it to be cloned. You will NOT be able to easily modify the base VM AFTER you’re created differencing disks of it, so pay close attention.

In the Microsoft Virtual PC console, click on the Settings button for the base image VM. Click on the Enable Undo Disks checkbox and click Ok.

At this moment you should have 2 files in the base VM’s folder. A VHD file for the virtual disk, and a VMC file for the VM settings.

Step #4 – Boot the base image VM once and quickly shutdown without committing changes

Now you need to boot the base image VM once. Let it boot all the way, log on to the OS if you want to.

If the base image cannot be booted “all the way”, because, for example, you’ve got a SYSPREP unattended script waiting for the cloned machines to be booted and you’d like to keep it that way, do NOT boot it “all the way”, and instead just let the VM boot for a few seconds. When either the logon page has appeared, or you think enough time has passed (and a few seconds is all you need), close the base VM by closing the Virtual PC window for the VM.

Make sure you select Turn Off and Save Changes from the drop-down list, and UNSELECT the Commit Changes to the Hard Disk checkbox. Now press Ok.

If you look at the base VM’s folder you will see 3 files. A VHD file for the virtual disk, a VMC file for the VM settings, and a VUD file for the undo disk. The VUD file is probably very small, but fear not, it will not remain so for long.

Step #5 – Rename the undo disk

Now we need to rename the VUD undo disk to whatever the new cloned hard disk will be called, and change the file type to VHD. Click on the VUD file and either right-click and select Rename or press F2.

Now you have a (small) new VHD that is linked to the base virtual hard disk of the base VM.

You can also copy the original VMC file, or, if you want to, you can create a new one in step #7.

Step #6 – Disable undo disks for the base image VM

Now we need to disable the Undo Disk feature for the base VM. In the Microsoft Virtual PC console, click on the Settings button for the base image VM. Click to UNSELECT the Enable Undo Disks checkbox and click Ok.

Note: You must never re-boot the base VM. If you do so, you might ruin all the differencing disks that are related to it.

Step #7 – Delete the base VM from the Virtual PC console

Since you are not allowed to ever reboot the base VM you can simply delete it from the list of VMs in the Virtual PC console.

Step #8 – Configure the base VM hard disk to be read only

Open Windows Explorer, right-click on the original VHD file, and select Read Only. Press Ok.

Step #9 – Create a new VM by using the renamed undo disk of the base image VM

Now we can create as many new VMs from the cloned VUD file that we renamed in step #5. You can copy that file as many times as you want, and for each time you copy it you can create a VM out of it. Follow the steps outlined in my “Creating Virtual Machines with Microsoft Virtual PC 2007” article.

Note: Remember the SYSPREP issues mentioned in step #2. Any cloned machine that you want to place on the same network as other cloned machines must be SYSPREPed. Note: The cloned VM hard disks can have Undo Disks enabled on them, if you so please. Note: Remember, you will (probably) need to activate each cloned machine, unless you’re using an OS that does not require activation or has a VLK license. Finally, when you boot your cloned machines they work normally, and when you close them they save their changes to the differencing virtual hard disk that uses the now-unchanged base VM hard disk.