Freigeben über


Dual Boot Hyper-V VHD

This is a note to myself and others Smile about how I added a Windows Server 2008 Hyper-V VHD as dual boot over an existing Windows 7 installation.

Before start, generate a new partition at the end of the Windows 7 partition, using diskmgmt.msc console. You can do this by shrinking the existing Windows 7 volume and add a new partition in the free space you get afterwards.

If you are using Bitlocker in your Windows 7 partition, note that your VHD needs to boot from an unencrypted partition, so if you want to protect your Hyper-V VMs with Bitlocker, the way to go is running Hyper-V VM from unencrypted partition and mount your Windows 7 partition with your Bitlocker keys and load your protected VMs from there.

Important: Ensure  that your Hyper-V dedicated partition has enough space to host both your Hyper-V VM and a pagefile.sys of the size of your physical RAM. In my case, my Hyper-V VM was 8,5 GB, and had to leave another 8 GB for paging file. It is also recommended to leave some more space for Windows Updates to the Hyper-V VM itself.

Once you have your fresh new partition with your “Hyper-V.vhd” file on it and room for paging file, do the following:

1.- Run BCEDIT without params to show boot entries and copy "Windows 7" entry GUID to clipboard

2.- Copy Windows 7 boot entry as Hyper-V entry

    bcdedit /copy {Win7-GUID} /d "Hyper-V"

3.- List boot entries again (BCDEDIT) and copy "Hyper-V" entry GUID to clipboard

4.- Change Hyper-V entry device and osdevice options to VHD

    bcdedit /set {Hyper-V GUID} device   vhd=[H:]\Hyper-V.vhd
    bcdedit /set {Hyper-V GUID} osdevice vhd=[H:]\Hyper-V.vhd

5.- You can also specify [LOCATE] as drive letter, so boot loader will seek existing
    volumes for your VHD:

    bcdedit /set {Hyper-V GUID} device   vhd=[LOCATE]\Hyper-V.vhd
    bcdedit /set {Hyper-V GUID} osdevice vhd=[LOCATE]\Hyper-V.vhd

6.- You may need to enable Hypervisor with bcdedit if you are unable to enable Hyper-V role
    even with VT extensions and DEP enabled in system BIOS, and you get the following warning
    in the Hyper-V role event log:
    Event 5: Hyper-V launch aborted due to auto-launch being disabled in the registry.

    bcdedit /set {Hyper-V GUID} hypervisorlaunchtype auto

 

Now you can restart and see your “Windows 7” and your “Hyper-V” entries in your boot menu.

Enjoy!