Using Native VHD Boot

Windows 7  and Server 2008 support booting a physical machine from a virtual hard disk (VHD). This post describes the easiest way to create a multi-boot system using native VHD boot and how to use the VHD on multiple machines.

Options to work with multiple OSes on one physical machine are:

  • Multi-boot using a separate disk partition for each OS
  • Run multiple virtual machine guests in a physical host OS
  • Multi-boot using virtual hard disks (native VHD boot)

The advantages of native VHD boot are:

  • It uses physical hardware.
    The performance penalty of using a VHD vs a native disk is negligible.
  • No need for a separate partition.
  • Less disk space needed.
    When using a dynamic VHD, the VHD occupies its defined size only while being used. When the OS booted from the VHD is shut down, the VHD only occupies the space actually written to it.
    Ex: a clean 2008 Server dynamic VHD needs a minimum of 40 GB when running and approx. 9GB when shut down.
  • Possibility to use a copy of the VHD on different computers.
    Ex: workstation and notebook
  • Possibility to use the VHD as virtual machine under XP-Mode or Hyper-V.

Simply installing a second OS into a VHD from within a running OS does not work.
Ex: Trying to install Server 2008 R2 SP1 from Windows 7 SP1 results in the following error:
image

There are two main options to create a bootable VHD:

  1. Create VHD and install with booting from setup DVD
    This option is not officially supported.
  2. Turn a Windows 7 or Server 2008 DVD or ISO into a bootable VHD

[In his blog post Worlds Easiest boot to VHD directions for Windows 8 Charles Sterling describes a third easier method].

Create a bootable VHD using Install-WindowsImage Script

I used the following steps to add booting into 2008 Server to an existing Windows 7 Installation.

Download Install-WindowsImage PowerShell Script.

Unpack the 2008 Server ISO using 7-zip.
Or mount the ISO using Daemon Tools (faster).

Create a VHD volume (ex 40GB, V:)
Using Windows Disk Management, Action, Create VHD

Apply Windows Server 2008 R2  .wim image to the VHD volume
using Install-WindowsImage.ps1.


PS F:\BootableVHDs>  .\Install-WindowsImage.ps1 -WIM H:\Sources\Install.wim -Apply -Index 1 -Destination V:\
 Applying "Windows Server 2008 R2 Standard (Full Installation)" to V:\...
 WARNING: This may take up to 15 minutes...

Elapsed Time: 00:03:27.6823091

Configure the VHD for native boot or to boot in a VM

bcdboot V:\Windows

Now the machine boots into Server 2008 by default.

Boot into new OS

Boot in to the new OS  and let Windows configure itself. With my 2008 Server the first configuration step took about 3 Min. Between automatic reboots Server 2008 asked for the localization infos and the product key.

After Windows configuration is complete: Change the boot menu default and timeout (ex: 3 sec) using Windows System Configuration to your liking.
BTW: Trying to change to boot menu timeout using “bcdedit /default {current}” resulted in  in error: “Parameter Incorrect”.

Use VHD on different PC

To use the VHD on a different machine:

  • Copy the VHD File to other PC
  • Attach the VHD
    Using Windows Disk Management, Action, Attach VHD
    Ex: D:
  • Configure the VHD for native boot
    Ex: bcdboot D:\Windows
  • Boot into the VHD
  • If the OS crashes on boot because the new hardware is too different:
    1. Make a copy of the source VHD.
    2. Remove hardware specifics from the source VHD
      using a Sysprep \generalize \shutdown from within the source VHD.
      Sysprep is installed in 2008 Server by default under
      %windir%\system32\sysprep\sysprep.exe
    3. Copy the VHD to the other PC and try again.
    4. Restore your original copy.

Links

Some background links from MS Technet: How to Perform Common Tasks for Virtual Hard Disks (VHD)

About these ads

About Peter Meinl

IT Consultant
This entry was posted in Computers and Internet and tagged , . Bookmark the permalink.

2 Responses to Using Native VHD Boot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s