VHD Native Boot (updated)

Are you working with Virtual Machines like Oracle’s VirtualBox or Microsoft’s VirtualPC? Have you had problems with the performance of those or hardware which is not supported. In this article I will show you how you can circumvent these restrictions with VHD Native Boot for Windows.

VHD Native Boot

A native-boot VHD is a virtual hard disk that can be used as the running operating system on designated hardware without any other parent operating system. This is in contrast to a scenario where a VHD is connected to a virtual machine on a computer with a parent operating system.

 

Advantages

  • (Almost) Full Hardware Performance compared to virtual machines
  • Simplicity for creating and deploying VHD’s; just copy them to the destination machine
  • Full Hardware Support, e.g. 3D Graphic Cards
  • Reset Capability, when using dynamic VHD’s

There is always a flip side of the coin. The VHD native boot feature is only supported by some editions of Windows (see below). Some other features are not available, when you have booted the VHD natively.

 

Limitations

  • Windows 7/8 Enterprise or Ultimate
  • Windows 2008 Server R2
  • No nesting of VHD native boot
  • No Bitlocker
  • No Hibernation
  • VHD cannot be a dynamic disc
  • Parent volume cannot be a dynamic disc

 

Usage of VHD Native Boot

There might be different drivers for using VHD Native Boot. Essentially these are the same drivers as for virtual machines, just that you have a much better performance and full hardware support.

Some of the most popular usage of VHD Native Boot include, but is not limited to:

  • Snapshot of a certain configuration for product maintenance on older operating systems
  • Testing of installers on a clean system
  • Testing in general on a clean system with full performance
  • Checking out functionality or feasibility of new operating systems like Windows 8

 

Walkthrough: Deploy a Virtual Hard Disk for Native Boot

1. Create the VHD

Start an Admin CMD prompt and enter the following commands:

c:>diskpart

DISKPART> create vdisk file=”c:\vhd\win7.vhd” type=fixed maximum=20000

DISKPART> select vdisk file=”c:\vhd\win7.vhd”

DISKPART> attach vdisk

DISKPART> CREATE PARTITION PRIMARY

DISKPART> ASSIGN LETTER=X

DISKPART> FORMAT QUICK LABEL=Windows7vhd

DISKPART> EXIT

For productive environments the “fixed” VHD type is recommended. In your setup you might need more than just 20 GB. For testing purposes you can also use the “expandable” type.

Now you have an empty VHD file on your disk. In the next step, I will explain how you put a bootable Windows 7 into that empty VHD.

 

2. Import Windows 7 into VHD

For that purpose you need two things

a) The Windows Automation Installation Kit WAIK, which contains a tool called ImageX. You can get the tool in the 1.6 GB WAIK download here.

b) A Windows 7 DVD or ISO file accordingly.

 

Since the Windows 7 media contains multiple editions, we have to find out which one we wanna use for our purposes. Use 32 or 64 bit versions depending on your current OS.

c:\Program Files\Windows AIK\Tools\amd64>imagex /info “e:\sources\install.wim”

ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Version: 6.1.7600.16385

WIM Information:
—————-
Path:        e:\sources\install.wim
GUID:        {740db9a2-6823-4814-abe8-89a7c61d29b0}
Image Count: 5
Compression: LZX
Part Number: 1/1
Attributes:  0xc
             Integrity info
             Relative path junction

Available Image Choices:
————————
<WIM>
  <TOTALBYTES>2146315314</TOTALBYTES>
  <IMAGE INDEX=”1″>
    <DIRCOUNT>9357</DIRCOUNT>
    <FILECOUNT>46463</FILECOUNT>
    <TOTALBYTES>7854310823</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CA0443</HIGHPART>
      <LOWPART>0x6568BDF8</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CA0464</HIGHPART>
      <LOWPART>0xD1F2D8D8</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>0</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCT
      <EDITIONID>Starter</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      …

    <DISPLAYDESCRIPTION>Windows 7 Professional</DISPLAYDESCRIPTI
  </IMAGE>
 
<IMAGE INDEX=”5″>
    <DIRCOUNT>9669</DIRCOUNT>
    <FILECOUNT>48121</FILECOUNT>
    <TOTALBYTES>8355904157</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CA0443</HIGHPART>
      <LOWPART>0x6568BDF8</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CA0465</HIGHPART>
      <LOWPART>0x31207234</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>0</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCT
      <EDITIONID>Ultimate</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      …

    <DISPLAYDESCRIPTION>Windows 7 Ultimate</DISPLAYDESCRIPTION>
  </IMAGE>
</WIM>

c:\Program Files\Windows AIK\Tools\amd64>imagex /apply “e:\sources\install.wim” 5 x:\

In the example above the index 5 denotes the Windows 7 Ultimate Edition, which we are going to fetch into the VHD. The VHD was mounted as drive X: in step 1.

This process will take a while and you should see a similar output like I have shown here:

ImageX Tool for Windows

Copyright (C) Microsoft Corp. All rights reserved.

Version: 6.1.7600.16385

[ 100% ] Applying progress

Successfully applied image.

Total elapsed time: 35 min 3 sec

 

3. Create Boot Entry

For this purpose we use the command line tool “bcdedit”. Just enter it without arguments and you will get a list of currently available boot entries.

This is at your own risk now! For your safety, you can create a backup copy into a file.

C:\>bcdedit /export “c:\BcdeditBackup.bin”

The operation completed successfully.

Now we can manipulate the boot entries and add our VHD native boot option.

C:\>bcdedit /copy {current} /d “My Native Boot VHD”

The entry was successfully copied to {8a88ab8d-cbe1-11de-92f8-ae71be5d863d}.

You need to copy the GUID above within the cmd shell. Right mouse click and then use “Mark”. Now you can select the GUID including the curly brackets. Hit Enter. To paste you just use another right mouse click.

Let’s continue with the next commands (use it exactly as shown including the square brackets!):

C:\>bcdedit /set {8a88ab8d-cbe1-11de-92f8-ae71be5d863d} device vhd=\win7\win7.vhd

C:\>bcdedit /set {8a88ab8d-cbe1-11de-92f8-ae71be5d863d} osdevice vhd=\win7\win7.vhd

C:\>bcdedit /set {8a88ab8d-cbe1-11de-92f8-ae71be5d863d} detecthal on

If something goes wrong, use bcdedit /delete {your GUID} to remove that entry you have just created and start over.

 

4. Boot

You are now ready to boot your system. You should see your new entry in the boot menu and can boot your VHD natively on your hardware.

You might check out the new disk mapping, where your old C: will become D: and your VHD is now your C: drive.

 

Alternatives to Get a VHD

Besides the description above, there is another possibility to get a VHD image is to use Windows 7 Backup. The system backup creates a VHD which is an exact copy of what you currently have installed on your machine. All the drivers will later match your hardware and connected devices when you are booting into the VHD.

You can also boot from a Windows 7 DVD and attach the previously created VHD during the setup. Then install Windows 7 directly into the VHD with the Windows 7 setup. See here for details.

A third alternative is Disk2VHD from Sysinternals. I have used it about two years ago, but cannot tell, whether it still works or not.

Yet another possibility is to use one of the pre-created VHD’s from Microsoft. Here’s an example of Windows Server 2008 with an installed SQL Server 2005.

 

 

I am looking forward to hear where you have succeeded using VHD Native Boot.

Good luck!

PS: Microsoft has created a very nice step-by-step walktrough how to create VHD’s and apply them to the boot menu. See here for this article.

About the author

3 comments

  • When I try to create a new Windows 10 UWP, or open or build existing samples or projects, I get the following error: The imported project “”C:Program Files (x86)MSBuildMicrosoftWindowsXamlv14.08.2Microsoft.Windows.UI.Xaml.CSharp.targets”” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk I am running VS2015 Enterprise on Windows 10 Pro. Windows 10 SDK (10240) and Emulators installed. Have re-installed VS2015 several times without luck. There is no v14.08.2 folder on my machine. Tried to copy the v14.08.1 folder to create v14.08.2 folder but this only allows you to load the project or create new ones, but build fails. This is driving me crazy. Note: An earlier install of same VS2015 ISO and SDK on Windows 10 Enterprise Evaluation was running successfully until I had to re-format a few days ago when I upgraded my Windows 7 to Windows 10 Pro. I have now also tried to install a clean copy of Windows 10 Enterprise, re-install VS2015 with SDK and emulators, and yet no luck. Same error keeps repeating. Re-installed VS2015 Enterprise installed on dual-boot Windows 10 Pro, and Windows 10 Enterprise. Same results. Have VS2013 running on the Windows 10 Pro. Had used VS2012, and VS2010 on same system with Win 7 without issues. Windows 10 Enterprise is a clean install. Have tried the modify several times. The only options not installed were 3rd-party tools.

  • Yet another possibility is to use one of the pre-created VHD’s from Microsoft. Here’s an example of Windows Server 2008 with an installed SQL Server 2005.

By Thomas

Recent Posts