Monday, September 16, 2013

Windows 8: Booting From a VHD

Since Windows 7, the OS has supported the ability boot the comptuer from a VHD (Virtual Hard Disk) or ISO file.   The VHD files were originally created for Microsoft's Virtual Machine (VM) technologies like Hyper-V.
  • Create or mount an existing VHD, and place it in an easy to find location such as C:\VHD.  For this example purposes the VHD file will be called C:\VHD\VHDTEST.VHD
  • Open up the administrator command prompt, from the Run... command type CMD.EXE and press Ctrl + Shift + Enter.
  • Run the following command: bcdedit /copy {current} /d "Windows Test VHD" (the name is quotes is arbitrary and is only for demo purposes, but it's what will show up in the Windows Boot Manager list at startup).  This command creates GUID that is associated with VHD that was just created and will be needed later in the successive steps.  
  • Run the following command: bcdedit /set device vhd=[C:]\VHD\VHDTEST.VHD (Note: the brackets around the drive letter are necessary)
  • Run the following command: bcdedit /set osdevice vhd=[C:]\VHD\VHDTEST.VHD. This command associates the GUID with the physical location of the VHD file.
  • Run the following command: bcdedit /set detecthal on (allows the VHD to access the physical computer resouces, such as the processor, virtualization technologies, USB drives, any other physical hard drives attached to the computer.)
  • Run the following command: bcdedit /v. Displays the all of the individual Boot Loaders that are available. 
To remove the VHD:
  • Open up the administrator command prompt, from the Run... command type CMD.EXE and press Ctrl + Shift + Enter.
  • Run the following command: bcdedit /v (find the GUID of the entry you want to delete)
  • Run the following command: bcdedit /delete {GUID} /cleanup
  • Now you should be able to delete the VHD if you no longer need it.

No comments: