Windows 7 and Windows 8 can be booted directly from a virtual hard disk (VHD) file in the absence of a hypervisor such as Hyper-V. In this post we'll learn how to create a VHD-based instance of Windows 8 that runs on an existing Windows 8 physical computer
Latest posts by Timothy Warner (see all)

Here's the situation: You are a Windows systems administrator who works from a Windows 7 or Windows 8 domain workstation. You need to test out some Windows Server 2012 features without touching any of your production machines. You also need to run Windows Server 2012 on physical hardware instead of as a virtual machine. What do you do?

  1. Purchase a new computer to run the Windows Server 2012 instance
  2. Configure your Windows workstation in a dual-boot configuration with Windows Server 2012
  3. Install Windows Server 2012 onto a VHD and boot your workstation u sing the VHD

In the context of today's 4sysops blog post, the correct answer is (C). 😉

The Native Boot to VHD technology included in Windows 7 and Windows 8 provides an excellent way to multi-boot a computer without the traditional hazards and inconveniences associated with physically installing multiple versions of Windows on the same hardware.

Similarly, the Boot to VHD capability works its magic in the absence of a hypervisor such as Hyper-V. Thus, we can boot a VHD-based operating system and access the host computer hardware directly.

Finally, we can back up and restore the entire configuration by working with a single file--the virtual hard disk (VHD) file!

The high-level overview for creating a Windows 8 VHD and booting from it is as follows:

  1. Create a VHD file and prepare it to receive an OS.
  2. Mount the Windows 8 DVD (or ISO file) on your host computer.
  3. Obtain ImageX.exe and use the utility to apply a Windows 8 image to the VHD file.
  4. Add the VHD-based Windows 8 installation to the host computer's boot menu.

We'll cover each overview step in detail right now.

Step #1: Create a VHD File

We can use the GUI Disk Management Microsoft Management Console (MMC) or the command-line diskpart tool to create the VHD file.

For instance, open Disk Management and click Action > Create VHD. This action invokes the Create and Attach Virtual Hard Disk dialog box, where you can define the VHD parameters. If you'd like, you can copy my settings as shown below.

Create a VHD by using the Disk Management console

Create a VHD by using the Disk Management console

Once you create and attach the VHD, be sure to initialize it and build a single, simple volume. The drive letter that Windows provides does not matter, although we need to remember the designation later in this procedure.

Step #2: Mount the Windows 8 DVD

This step is straightforward enough. If you don't have the physical Windows 8 media, you can use a number of third-party utilities to mount the ISO version of the DVD to your host computer's file system. For instance, I've had good luck with both of the following free tools:

Make a note of the drive letter assigned to the Windows 8 source media; you'll need that bit of info as well.

Step #3: Apply Windows 8 to the New VHD File

This is the only step that is a bit of a pain, only because you may have to download and install the huge Windows Assessment and Deployment Kit (ADK) for Windows 8. Why? Because the ImageX.exe tool that we need to complete this step is seemingly available only from within the Windows ADK.

Once you've installed that enormous toolset, you can extract ImageX.exe from the following path:

C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\x86\DISM

If you plan to run ImageX on a 64-bit system, then check the amd64\DISM folder instead.

Now, open an elevated command prompt on your host computer, navigate to the folder that contains ImageX, and run the following statement to "install" Windows 8 from its source WIM file to your newly created VHD:

ImageX /apply d:\sources\install.wim 1 f:\

Here's an explanation of the syntax:

  • /apply: This parameter "installs" a WIM image to a target
  • d:\sources\install: This is the path to the Windows 8 source media. Of course, you may have a different drive letter in play
  • 1: This is the WIM index number from the source media
  • f:\: This is the root of our VHD file. Again, your drive letter might be different from mine

I show you the results of the above syntax in the next screenshot.

Use ImageX and BCDBoot to configure the VHD for booting

Use ImageX and BCDBoot to configure the VHD for booting

If you pop open Windows Explorer and browse to the root of your VHD file, you'll see what appears to be a standard installation of Windows 8. I show you this interface below.

A VHD can host a fully functional copy of Windows 8

A VHD can host a fully functional copy of Windows 8

Step #4: Add the VHD to the Host Computer's Boot Menu

The final step is pretty easy: to add the new VHD installation to our host computer's boot menu, run the following statement from your elevated command prompt:

bcdboot F:\Windows

Again, I showed you the syntax results in Step 3.

We can now restart the computer at test out the new configuration!

Testing it Out

During the first system startup with the new VHD present, you'll see the interface shown below.

The Windows 8 boot loader screen

The Windows 8 boot loader screen

Deciphering the entries on the new boot menu is pretty easy if you've installed Windows 7, Windows Server 2008 or Windows Server 2002. However, things can get (seemingly) hairy if your host PC runs Windows 8 and you attach another Windows 8 VHD.

As you can read in the above screenshiot, my current default installation is on "volume 4." This tells me, by default, that my VHD installation is on "volume 2," whatever that is. For now, go ahead and select your new installation and let the boot proceed.

As shown in in the next screenshot, you'll be taken through the traditional Windows 8 out of box experience (OOBE) steps as if you were setting up a new computer. Hardware detection, prompts to run Windows Update--the works.

A VHD Windows 8 installation works exactly the same as a hardware installation

A VHD Windows 8 installation works exactly the same as a hardware installation

Once you're logged in, your best bet to customize the Windows 8 boot configuration database, which involves setting a default installation, setting a boot menu timeout value, and (most importantly here), renaming the boot entries.

I've had great luck with EasyBCD; if you want (or you are a glutton for punishment), you can use the built-in BCDEdit command-line tool or Windows PowerShell v3. I show you in the next screenshot how simple it is to customize the BCD by using the free EasyBCD tool.

EasyBCD makes short work out of managing the Windows boot configuration database

EasyBCD makes short work out of managing the Windows boot configuration database

So there you have it, friends! Please be aware that although I used only Windows 8 in this example, these steps should work with any combination of Windows 7, Windows Server 2008 R2, or Windows Server 2012.

2 Comments
  1. Paul 10 years ago

    I wonder if there would any benefit of running from a VHD instead of directly from the physical media? Sounds like fun….

  2. Tim Warner 10 years ago

    Hey Paul. Sure, there are plenty of good reasons to consider running an OS on hardware from VHD. Look at it this way–to back up your entire system, you have only to back up one file. Same with restore. Not to mention that you get full benefit of your host PC hardware instead of sharing it like you have with virtual machines. Thanks, Tim

Leave a reply

Your email address will not be published.

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account