Windows 7 VHD Install – part 1

Some introduction…

Let’s go tech for a change. This is for people who use and like Windows, so if you’re totally into Linux or Mac’s then please move along, there’s nothing to see here…

When Microsoft came op with the .vhd file format, they were really only intended as virtual hard disk containers for their Virtual PC / Server line of products. Virtualization is all about tricking an operating system (like Windows) to think it is being installed and running on physical hardware, while in reality it is “just” a guest on some piece of clever software running on a host machine. VHD files play a major role, acting as if they are physical hard disks for the guest operating systems. However it has become clear that VHD’s can do much more, they are in fact the perfect data container with full NTFS support.

Windows 7 (and thus also Server 2008 R2) added a neat trick to its boot loader: the ability to boot from a VHD file as if it were a real hard disk. This opened some intriguing possibilities, and after a few demo’s I saw I decided to take things a bit further and see what I could do with Windows 7 running from a VHD. The thinking behind it was simple: I get to use new hardware  regularly, and having to re-install my OS over and over again was getting rather annoying. But what if I could just copy my VHD files to the new hardware, that would be a piece of cake hardware migration!

The end result. Here’s a screenshot of my laptop’s Disk Management console. Look carefully, and you’ll note that in fact Disk 0 is the only physical hard drive. It contains the E: partition with two VHD files which are used by the Operating System as two separate hard disks.

Before we start, a quick note. This series of posts (yes, there will be more!) are written for Windows 7. However, everything works just as well for Server 2008 R2! In fact, besides my VHD’d laptop I have also been running a 2008R2 server for almost a year now, without a hitch. So…simply put: it’s SAFE!


Installing Windows 7 on a VHD

– Start the Windows 7 setup.

– In the language and keyboard layout selection screen, open a command prompt with Shift-F10.

– Type the commands as shown below. Choose the folder structure where your VHD(‘s) will reside, as well as the name of your system partition VHD to your own liking. Also the size of the VHD can be adjusted, it must be at least 24 GB but I would recommend the 30 GB (30720 MB) as shown below. VHD’s larger than 127 GB are not recommended.


    select disk 0


    create partition primary size=100


    create partition primary

    assign letter=h

    format fs=ntfs quick



md VHD


    create vdisk file="h:\VHD\<name>.vhd" type=expandable maximum=30720

    attach vdisk



– Continue the Windows 7 setup.

– On the “Where do you want to install Windows?” screen, select the partition you just created as a VHD, disregard the warning and just click Next.

– The rest of the Windows 7 setup is no different than when installing to a hard disk.

– The pagefile must be on a physical disk, but this might give you problems when assigning a different drive letter to the physical partition. The solution then is simple: in Disk Manager shrink the physical partition, temporarily create a new physical partition and put the pagefile there. After a reboot you can change the drive letter as required. Reboot again and move the pagefile to its permanent location. One more reboot and you can remove the temporary partition and extend the physical partition to its original size.



So…you’re now running Windows 7 from a VHD. Doing so you’ve gained much flexibility when it comes to backup, disaster recovery and future migration to new hardware (no complete OS reinstall over and over again!). What have you lost? Not much, but here’s the rundown:

– An estimated 1 to 3 % loss in performance. Point is: you won’t even notice.

– According to Microsoft, upgrade to a new OS ( Windows 8 ) won’t work. I haven’t tried this yet but my thought is: we’ll see by then.

– Hibernate doesn’t work. But contrary to some reports sleep does, perfectly.

– The Windows Performance Index won’t calculate. Therefore, because there is no reason to regularly let Windows re-calculate the index, it is safe to disable the Windows / Maintenance / WinSAT task in Task Manager.

This concludes the first part of my ramblings about Windows 7 on VHD. Next time I will be talking about mounting additional VHD’s, making backups of your VHD’s, and disaster recovery.



Leave a Reply

Your email address will not be published. Required fields are marked *