Boot to VHD (Native Boot): Add a Virtual Hard Disk to the Boot Menu

Applies To: Windows 8, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

Here's how to add a a virtual hard disk (VHD) to the boot menus . This is known as 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 differs from a scenario where a VHD is connected to a virtual machine on a computer that has a parent operating system.

VHDs can be applied to computers that have no other installations of Windows, for usage as a native-boot VHD, without a virtual machine or hypervisor. (A hypervisor is a layer of software under the operating system that runs virtual computers.) This enables greater flexibility in workload distribution because a single set of tools can be used to manage images for virtual machines and designated hardware.

Note

This walkthrough describes how to deploy the VHD to a computer that has no other installations of Windows. For more information about how to deploy multiple VHDs with native-boot on a single computer, or deploying VHDs on computers that have a parent operating system, see Download and install Windows PE (WinPE) so you can boot from a USB flash drive or an external USB hard drive.

Prerequisites

To complete this walkthrough, you need the following:

  • A technician computer that is running Windows® 7 or Windows® 8. A technician computer is any computer that has the Windows Assessment and Deployment Kit (Windows ADK) tools installed on it.

  • A Windows 8 image (.wim) file.

Note

Use a generalized Windows image. A specialized image is customized to a specific computer, whereas a generalized image can be deployed across many computers. For more information about the specialize and generalize configuration passes, see Windows Setup Configuration Passes.

  • A Windows 8 Windows PE disk. For more information, see WinPE: Create USB Bootable drive.

  • A destination computer on which to install the VHD. This computer requires 30 gigabytes (GB) or more of free disk space. You can install the VHD to a computer already running other operating system installations, or as the only operating system on a computer.

For more information about how to use VHDs in an enterprise environment, see Understanding Virtual Hard Disks with Native Boot.

Step 1: Create a VHD

  1. On the technician computer, use the Diskpart tool to create, attach, partition, and format a new virtual hard disk. You can attach a VHD by using the Attach vdisk command which adds the .vhd or .vhdx file as a disk to the storage controller on the host. This virtual disk will appear as the V: drive at the end of this procedure. The Detach command will stop this virtual disk from appearing on the host.

    In this example, you create a 25 GB fixed-type VHD. For more information about VHD image types, see Understanding Virtual Hard Disks with Native Boot. For more information about the DiskPart tool, see this Microsoft Web site.

    At a command prompt, type:

    diskpart
    
    create vdisk file=C:\windows.vhd maximum=25600 type=fixed
    
    select vdisk file=C:\windows.vhdx
    
    attach vdisk
    
    create partition primary
    
    assign letter=v
    
    format quick label=vhd
    
    exit
    

Step 2: Apply a Windows image

  1. Use the Deployment Image Servicing and Management (DISM) tool to apply the .wim file to the primary partition of the VHD. At a command prompt, type:

    Dism /apply-image /imagefile:install.wim /index:1 /ApplyDir:V:\
    
  2. Use the DiskPart tool to detach the virtual disk after you apply the image. At a command prompt, type:

    diskpart
    
    select vdisk file=C:\windows.vhdx
    
    detach vdisk
    
    exit
    
  3. Copy the VHD file to a network share or USB hard drive. For example,

    net use n: \\server\share\
    md N:\VHDs
    
    copy C:\windows.vhdx n:\VHDs\
    

Step 3: Clean and partition the destination computer

  1. Boot the destination computer by using your bootable Windows PE media.

  2. Clean the hard disk using the DiskPart tool.

Warning

Running this command will delete all information on the computer. If you are deploying a VHD and want to maintain an existing native-boot VHD deployment or running operating system on the destination computer, do not run this command. See Download and install Windows PE (WinPE) so you can boot from a USB flash drive or an external USB hard drive for more information.

At a command prompt, type:  
  

    diskpart
    
    select disk 0
    
    clean
  1. Create a system partition. This example uses a 300 megabyte (MB) system partition. At a command prompt, type:

    create partition primary size=300
    
    format quick fs=ntfs
    
    assign letter=s
    
    active
    
  2. Create a primary partition. In this example the primary partition is given the remaining disk space. At a command prompt, type:

    create partition primary
    
    format quick fs=ntfs
    
    assign letter=c
    
    exit
    

Step 4: Deploy the VHD with native-boot capabilities

  1. Copy the VHD file to the destination computer. At a command prompt, type:

    copy N:\VHDs\Windows.vhdx C:
    
  2. Use the DiskPart tool to attach the VHD on the destination computer. At a command prompt, type:

    diskpart
    
    select vdisk file=C:\windows.vhdx
    
    attach vdisk
    
  3. The VHD is assigned a volume letter when it is attached. Find the letter associated with the VHD in the volume list and then exit the DiskPart tool. At a command prompt, type:

    list volume
    
    select volume <volume_number_of_attached_VHD>
    
    assign letter=v
    
    exit
    
  4. Use the BCDboot tool, located in the \System32 directory of the Windows 8 VHD or in a Windows 8 Windows PE media, to copy the boot-environment files from the \Windows directory in the VHD to the system partition. The BCDboot tool will create the BCD configuration to boot from the VHD. For more information about the BCDboot tool, see BCDboot Command-Line Options.

    For example, at a command prompt, type:

    cd v:\windows\system32
    
    bcdboot v:\windows
    
  5. Use the DiskPart tool to detach the virtual disk. At a command prompt, type:

    diskpart
    
    select vdisk file=C:\windows.vhdx
    
    detach vdisk
    
    exit
    
  6. Restart the destination computer.

    The Windows 8 Boot Manager will boot the Windows 8 operating system image that is contained in the .vhdx file.

Next Steps

To deploy a second VHD with native-boot capabilities to the same computer, you can copy the file and add it to the existing BCDboot menu using the BCDedit tool. For more information, see Download and install Windows PE (WinPE) so you can boot from a USB flash drive or an external USB hard drive.

See Also

Tasks

Download and install Windows PE (WinPE) so you can boot from a USB flash drive or an external USB hard drive

Concepts

Understanding Virtual Hard Disks with Native Boot