Sunday, November 21, 2010

Dual Boot from VHD Using Windows 7 and Windows Server 2008 R2

Boot from VHD is a new technique for installing and maintaining operating system environments. Unlike virtual machines, the operating system that is running from a “boot from VHD” environment is using the actual hardware instead of emulated hardware. This means a developer could easily use WPF and the full GPU processing power of a high end graphics card. In another scenario, this technology makes it easy to setup and run Windows Server 2008 R2 with the Hyper-V role, thus supporting 64 bit virtualization workloads.

The Virtual Hard Disk (VHD) is the container for the installed operating system. Because everything is inside a single file, there are a number of benefits that can be realized for data center server environments, as well as managed desktop environments. The following article dives into the technical details of implementing two operating systems. Both are installed in a VHD file and can easily be booted by selecting the preferred environment at power on. This could easily be scripted and automated.

The Installation Foundation – Windows PE

The Windows Preinstallation Environment (WinPE) has been updated for Windows 7 and Windows Server 2008 R2. One of those improvements is the ability to use a Virtual Hard Disk (VHD) file as the target for an installation of the operating system (OS).

This has some interesting implications. Booting from a .VHD file that contains an entire OS seems rather magical. I mean think about it. You go to look at a hard drive and there’s a single file but Windows Server 2008 R2 is installed inside it. This would certainly simplify the ability to boot your servers on a completely new environment with little effort. This is going to turn change management on its ear.

The same is true for the desktop OS, Windows 7. You can install Windows 7 inside a .VHD file. Again, the OS is installed inside a single file and thus makes it rather easy to move or change out and bring up a completely different version of the environment. This will make test environments for developers super easy to construct and test discrete sets of applications or components.

One thing that is not well known is how easy it is to create the initial .VHD file and install the operating system into it. The supported and documented ways are geared towards very well defined support scenarios. You can see the supported scenarios in the Windows Automated Installation Kit (WAIK). Most people have been reluctant to take the time to learn this because it involves the use of imagex captures and applies.

What if you could install with just the DVD?

You can. All you need is a hard drive with disk space and the DVD for Windows 7 RC or Windows Server 2008 R2 RC. In fact, when I was investigating the tools for this article I used a brand spanking new Hitachi 2.5” 320GB 7200rpm hard drive and both DVDs to create a dual boot environment. Nothing more. And it’s much simpler than I thought. The key is WinPE and DISKPART. Here is the screencast demonstration of the tools in action.

The Screencast Video – 23 minutes – Win7 and R2 Dual Boot via VHD

Get Microsoft Silverlight

The Command Sequence Used in the Video

  1. Boot your machine with a blank hard drive using the Windows 7 DVD.
  2. Click next on the language screen if English is appropriate.
  3. SHIFT+F10 to launch a WinPE command console. Although the commands below are in upper case, the commands are not case sensitive. I am only using upper case for readability here.
  4. Enter DISKPART to run the utility.
  5. LIST DISK to see the available disks in your system. I am assuming a single raw disk.
  6. SEL DISK 0
  10. ASSIGN
  11. LIST VOL
  12. CREATE VDISK FILE=c:\windows7rc.vhd MAXIMUM=200000 TYPE=EXPANDABLE
  13. SELECT VDISK FILE=c:\windows7rc.vhd
  18. LIST VOL
  20. exit DISPART
  21. exit WinPE command console
  22. Install to the newly created 200GB (fuzzy math) virtual hard disk which looks just like a partition to Windows Setup
  23. Repeat steps 11-18 for the Windows Server 2008 R2 VHD but with the obvious changes for the vdisk filename, size, etc.

Other References and Articles

Windows Automated Installation Kit (WAIK) for Windows 7 and Windows Server 2008 R2 RC – get it @ This is the bible for the supported methods of using “Boot from VHD”.

Windows Virtualization Blog – see their VHD boot post at Particularly interesting is the performance area of the post.

Knom’s Developer Corner – another nice post at

No comments:

Post a Comment