This is a mirror of official site: http://jasper-net.blogspot.com/

Boot to VHD / Boot from VHD

| Tuesday, October 26, 2010
I recently learned about boot to/from Virtual Hard Disk (VHD) and how it makes it very easy to set up and manage multiple system configurations. After having my Windows 7 configuration get completely messed up and being really lazy about creating clean OS images, I figured I would give the VHD route a try and discovered it's much easier than I expected - if you can create an image in Virtual PC, you can change it to be bootable. The gist of how it works is you create a virtual image for use within a VHD (I used Hyper-V from Server R2) and then you use bcdedit (the Windows boot manager, BCD stands for Boot Configuration Data) to copy an existing entry and point that entry to the VHD file.

Here are the steps I took with some details where things get a little tricky:

First, I installed Windows Server 2008 R2.

Next, I opened Server Manager and added/enabled the Hyper-V role.

Next, I opened the Hyper-V manager and added a new Virtual Machine (VM).

I installed Windows 7 in the VM.

After the VM was set up, I shut it down and copied the virtual machine file [Win7.vhd] from the default folder [C:\ProgramData\Microsoft\Windows\Hyper-V\] to a new folder named  to [c:\VHDs\Win7.vhd].

Finally, I opened an administrator command prompt and modified my boot configuration.

To modify my boot configuration, I needed to use bcdedit to add a virtual hard disk to the boot menu.  All I did was run the following commands:

C:\>bcdedit /copy {current} /d "Windows Server 2008 R2-Boot from VHD"
This returned a GUID, I copied that GUID and ran the following commands with the GUID set:

bcdedit /set {newguid} device vhd=[locate]\VHDs\Win7.vhd
bcdedit /set {newguid} osdevice vhd=[locate]\VHDs\Win7.vhd
bcdedit /set {newguid} detecthal on

And that was it.

Read more: See Also

Posted via email from .NET Info

0 comments: