Export (0) Print
Expand All

Preparing Virtual Hard Disks for Boot

Updated: October 15, 2010

Applies To: Windows 7, Windows Server 2008 R2

After you have a bootable VHD (a VHD that contains a Windows image), you can configure it for native VHD boot or configure it for booting in a virtual machine by modifying the boot configuration data (BCD). The locations of the BCD store and the other boot files that are required to boot the system are different for native boot and virtual machine boot. Use the steps in either of the following sections to configure the BCD as appropriate:

  • Prepare a VHD image for native boot. For native VHD boot, you configure the boot entry in the BCD store to be on the physical system partition outside of the VHD. The system partition can be the same or different than the volume that hosts the VHD file. For instance, by default Windows 7 Setup will create a separate 100 MB partition to host the BCD store.

  • Prepare a VHD image to boot inside a virtual machine. For a virtual machine boot, you configure the boot entry in the BCD store to be on the volume inside the VHD.

For more information about the syntax of the commands that are used in these topics, see the following resources:

BCDBoot Commands (http://go.microsoft.com/fwlink/?LinkId=155166).

Bcdedit (http://go.microsoft.com/fwlink/?LinkId=128459)

Prepare a VHD image for native boot

Use the procedure in this section to prepare a VHD for native boot.

noteNote
If you are an advanced user and familiar with BCDEdit, you can update the BCD manually instead of using the following procedure. To do this, run the following syntax at an elevated command prompt and note the GUID in the output: bcdedit /copy {default} /d “<your boot menu description>”. Next, using the GUID from the previous command, run the following two commands: bcdedit /set {GUID} device vhd=[C:]\VHD\<yournewvhd>.vhd and bcdedit /set {GUID} osdevice vhd=[C:]\VHD\<yournewvhd>.vhd

This procedure assumes you have Windows 7 or Windows Server 2008 R2 installed and you want to add a second boot entry to boot from the VHD. For this example, the VHD file is located in the C:\VHD\ directory, and the VHD is attached and assigned the drive letter, V.

For more information about configuring the BCD in other scenarios, see Add a Native-Boot Virtual Hard Disk to the Boot Menu (http://go.microsoft.com/fwlink/?LinkId=204162).

To update the BCD for native VHD boot

  1. Open an elevated Command Prompt window (right-click Command Prompt, and then click Run as Administrator).

  2. To create a new BCD entry for native VHD boot of the Windows image in your VHD file, type:

    V:\Windows\System32\bcdboot V:\Windows
    

    BCDBoot creates the boot configuration entry so that Windows Boot Loader can boot from the VHD image. It also sets the default boot option for the computer to boot from the VHD, which is currently assigned drive letter V.

    Optionally, you can use steps 3 through 5 if you want to modify the default boot entry.

  3. Run bcdedit (with no parameters) to display the system boot configuration entries.

    The following screenshot shows an example of the BCDEdit output with two Windows Boot Loader entries. The default boot option, {default}, is for the VHD boot from drive V, the other boot option is for the Windows 7 image that is installed on drive C.

    b8979a47-9e66-49ff-824f-0dc2d33584a0
  4. If you have Windows 7 installed on the hard disk drive, and you configure a native VHD boot of Windows 7, there will be two entries in the list with the description text string Windows 7. To change the text in the boot menu (from Windows 7), use the following syntax where the GUID is the identifier of the VHD boot entry:

    bcdedit /set {GUID} description=”Windows 7 VHD”
    
    noteNote
    Some boot entries have aliases instead of GUIDs (such as {default} for the default boot entry or {current} for the boot entry of the current system). To find the associated GUID, you can view the verbose output for all the boot entries by running bcdedit -v.

  5. To change the default boot option to be the installed version of Windows (instead of the native VHD boot image or an additional VHD image on the same computer), use the following syntax where the GUID is the Windows Boot Loader entry that you want to be the default:

    bcdedit /default {GUID}
    

    When you restart the computer, Windows Boot Manager displays a menu with a list of available images that you can boot.

Prepare a VHD image to boot inside a virtual machine

This procedure explains how to use BCDBoot to prepare a VHD image to boot inside a virtual machine. For this example, the VHD file is located in the C:\VHD\ directory, and the VHD is attached and assigned the drive letter, V.

To prepare an attached VHD image to boot inside a virtual machine

  1. Open an elevated Command Prompt window (right-click Command Prompt, and then click Run as Administrator).

  2. Type the following command to specify that V is the drive for Windows Boot Manager and the boot configuration data:

    V:\windows\system32\bcdboot V:\windows /s V:
    
    

    This command creates the boot configuration data on the partition inside the VHD that is used to boot Windows 7 in a virtual machine. You do not need to perform any other steps to prepare the image to boot in a virtual machine. Optionally, you can prepare the same VHD file to boot inside a virtual machine and for native VHD boot.

  3. Use the bcdedit /store <path> option to specify the BCD file inside the VHD as the BCD store, for example:

    bcdedit /store v:\boot\BCD
    
    noteNote
    You can specify the /store option with a BCDEdit command to update a BCD store other than the current store. When you are running Windows in a virtual machine, you do not need to specify the /store option to update a configuration store for the running virtual machine.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft