Windows 7 – VHD Boot – Setup Guideline

Windows 7 has a really useful feature called “VHD Boot”. With that you can boot your entire Windows out of a Virtual Hard Disk file (as those used with Virtual PC or Virtual Server).

This VHD file is mounted as a virtual disk, you can use it as a normal hard disk drive, but all the data is stored in ONE file. The machine is booted physically (unlike with Virtual PC), so you can only run one at a time, but have the full machine’s power.

The advantages are magnificent:

  • Simply copy one file (the .VHD file) and you’re entire system is included.
  • Create incremental VHD files: One VHD file can be based on another one. So if you have different systems, create a base Win7 VHD and make all others incremental. This will save a lot of disk space!

There’re also some small disadvantages :-)

  • The .VHD booted OS needs to be Windows 7, Windows Server 2008 R2 or later.
  • There’s a performance decrease of about 3%.
  • Hibernate and some BitLocker scenarios don’t work
    (BitLocker CAN be used within the guest VHD though, but not on the disk where the VHD resides).
  • Windows Experience index won’t work.

For the last three months, all my machines have been running as VHD booted ones.

Btw. you can exchange physically booted VHD file with Virtual PC VHD files. All you need to do is running sysprep /generalize /oobe. Also the OS needs to be 32-Bit because of Virtual PC.

So how do you install a VHD-Boot machine?

  1. Boot the system with a setup DVD or USB stick.

  2. At the setup screen, don’t choose “Install Now”, but press “Shift-F10” to get into command line mode [thanks to the many feedbacks for this shortcut!].
    2 

  3. Enter diskpart to start the partitioning utitlity.
    image

  4. Create a new VHD file by entering

    create vdisk file=”D:\pathToVhd.vhd” type=expandable maximum=maxsizeInMegabyte

    For differencing VHDs you need to add an additional parameter parent=”D:\pathtoparent.vhd” .
    image

  5. Now select the new VHD and attach it as a physical disk.

    select vdisk file=”D:\pathToVhd.vhd”
    attach vdisk

    image

  6. After that switch back to the setup window (e.g. using ALT+TAB) and start the setup.
    2

  7. Proceed the normal setup, but make sure you install to the correct disk (normally the last one), ignore the “Windows cannot install to this disk” warning!!

At next startup, you’ll see Windows 7 in the boot menu!

Optional: If you want to add a VHD manually to the boot menu, you just need to copy an existing entry and set some parameters:

bcdedit /copy {originalguid} /d "New Windows 7 Installation"
bcdedit /set {newguid} device vhd=[D:]\Image.vhd
bcdedit /set {newguid} osdevice vhd=[D:]\Image.vhd
bcdedit /set {newguid} detecthal on

 

Btw: My colleague Stefan has posted a detailed article on incremental disks.