This topic is a how to.
Please keep it as clear and simple as possible. Avoid speculative discussions as well as a deep dive into underlying mechanisms or related technologies.

(what is this box?)

Since Windows 7 and Server 2008 R2, it is possible to boot from a VHD (Virtual Hard Disk) file.

Note that you can only boot a VHD which has been created using Windows 7 or 2008 R2 or later, and you must configure the boot loader from an active installation of Win7 or 2008 R2. You can't use Virtual PC VHDs, only Hyper-V or raw VHDs . Don't try to reuse an existing VHD, start a new one for boot use.

Boot from an existing VHD

You need to edit the bootloader from within Windows, using the bcdedit command-line tool. To do this follow the steps below:

  1. Launch a Command Prompt as an administrator
  2. Type: bcdedit /copy {current} /d "VHD_Boot"
  3. Copy the long {CLSID} number given in the output, and use it in the following commands
    1. Note that {curly braces} are required
    2. You can change the drive letter and path of your VHD, but the square brackets on the drive letter are required
  4. Type: bcdedit /set {CLSID} device vhd=[C:]\disk1.vhd
  5. Type: bcdedit /set {CLSID} osdevice vhd=[C:]\disk1.vhd
  6. Type: bcdedit /set {CLSID} detecthal on
  7. To check the settings, type: bcdedit
  8. When you reboot, you will have the option to "VHD_Boot" as if it were a local installation.

Back to top

Boot with other inbox or vendor drivers

If the VHD was used to boot a Hyper-V VM, then the Operating System (OS) installed inside the VHD is configured to boot using default inbox IDE drivers (“IntelIDE”). This might not be the case for the physical system that you're going to boot. Your physical hardware may require a different driver (either inbox or vendor-supplied) to boot an OS. This is particularly true in case of SATA and/or RAID controllers..

  1. Mount the VHD under existing and running OS.
  2. Launch Registry Editor ("%SystemRoot%\RegEdit.exe").
  3. Load System Registry Hive from the OS installed into VHD ("<Your mounted VHD>\Windows\System32\Config\System").
  4. Locate the Current Control Set key using the value named “Current” under "<Your loaded hive>\SYSTEM\Select" key.
    1. For example, if “Current” value has Data equal 0x00000001 then Current Control Set key is "<Your loaded hive>\SYSTEM\ControlSet001".
  5. Under Current Control Set key locate the driver in question at "<Your loaded hive>\SYSTEM\ControlSet001\Services".
    1. For example, for popular series of Intel ICH RAID controllers built into many desktop PCs the key is "<Your loaded hive>\SYSTEM\ControlSet001\Services\iaStorV".
  6. Locate “Start” value for the above-mentioned key. If the driver was not used, then the current value would probably be 4. Change it to 0 (zero).
  7. For SATA drive configured as AHCI  you need find the key "<Your loaded hive>\SYSTEM\CurrentControlSet\Services\Msahci" and repeat the 6th step. 
  8. Unload the hive you loaded in step 3.
  9. Quit Registry Editor.
  10. Unmount the VHD.

Back to top

Add a new driver to existing OS installed inside the VHD file

If your hardware requires a custom mass storage driver provided by third-party vendor to boot an OS you need to inject that driver into the OS installed inside the VHD to make it bootable on your hardware.

  1. Locate the driver package on hardware manufacturer's website, download and unpack or extract it. You need to obtain the “essential” driver package consisting of one or more instances of all the following three file types (no archives or executive installers allowed!).
    • Installation information (a file with “.inf” extension).
    • Driver's binary (a file with “.sys” extension).
    • Digital signature catalog (a file with “.cat” extension).
  2. Mount the VHD under existing and running OS. The driver injection method described here assumes you're running Windows 7 or Windows Server 2008 R2 environment.
  3. Execute the following command:
    "%SystemRoot%\System32\DISM.exe" /Image:"<Path to your mounted VHD>" /Add-Driver /Driver:"<Path to the driver's installation information file>"
    Note: you need to provide the path to the file obtained on step 1 that has “.inf” extension.
    1. For example, assuming that
      • your VHD is mounted under “C:\Offline” folder;
      • your need to add the 64-bit driver for AMD AHCI RAID controller and
      • the driver files are located at “C:\Driver”,
      you should run:
      "%SystemRoot%\System32\DISM.exe" /Image:"C:\Offline" /Add-Driver /Driver:"C:\Driver\ahcix64s.inf"
  4. Unmount the VHD.

Back to top

Remove an entry from the bootloader

If you need to undo the operation described above and revert to single-boot configuration.

  1. Launch a Command Prompt as an administrator
  2. Type: bcdedit
  3. Copy the {GUID} for the relevant boot option
  4. Type: bcdedit /delete {GUID} /cleanup

Back to top

See Also

If you need to perform an opposite convertion operation see How To: Convert a VHD-Bootable Image into Hyper-V VM.

Back to top