Swapping between Native VHD boot and Hyper-V
Hi All,
I was building the Virtual PC that will be used in the “Wordpress on Windows Install Challenge” next Saturday on the Dutch Wordcamp event when I had to figure out if I could get this working.
My setup is a single laptop running Windows 7 native booted from a VHD as is described here. Unfortunately or great (Depends who you are talking to) Windows Server 2008 R2 only exists in 64bit so I couldn’t run it in Virtual PC as it currently only supports 32bit operating systems. So I started to create a VPC with Windows Server 2008 so I could use Hyper-V as a hypervisor which does support 64bit OSses.
I really love native boot VHDs they make live so easy and clear. I was working in WS2008R2 and build a Virtual Machine which the people will use on Saturday but all my tools of course were on my other VHD which runs Win7.
I thought I might be able to boot my main install in Hyper-V. I tried that and got a bootloader not found error message which makes sense as the bootloader of my laptop is on my system partition. After a little research I figured out how to make the VHD bootable by putting a bootloader on it.
From a command prompt run:
Open Diskpart
Select vdisk file=C:\<VHDFILENAME>.VHD
Attach Vdisk
select part 1
active
Assign letter=Z
exit
Now, at the command prompt, change to Z:\Windows\System32
Run, BCDboot.exe Z:\Windows /s Z:\
Run, BCDedit /store Z:\boot\BCD /set {bootmgr} device boot
Run, BCDedit /store Z:\boot\BCD /set {default} device boot
Run, BCDedit /store Z:\boot\BCD /set {default} osdevice boot
Change directory to C:\
open Diskpart again and run
Select vdisk file=C:\<VHDFILENAME>.VHD
detach vDISK
Exit
After this you can boot your VHD from Hyper-V it will install the drivers required and after a reboot it feels just like my main install. Only a bit slower as I have to reserve memory for the base os and my other VMs. If I want my power back I can boot native from the VHD and work from there.
On my physical disk there are only 3 files now windows7.vhd, hyperv.vhd and wordcamp.vhd (I like it).
See you all soon
Bram
Comments
- Anonymous
March 23, 2010
HiExcellent post. I wondered if you were able to native boot to hyperv.vhd, then in Win2008R2/hyper-v host server run multiple concurrent VMs. The reason I ask, is that Microsoft has released two eval vms for MOSS 2010 and VS2010 (2010-4a.vdk and 2010-4b.vdk) and I wouldn't mind running these on my laptop.cheersDaniel - Anonymous
March 19, 2012
I was wondering about activation, both Windows and office 2010.Both are actived as hard disk boot, I'm converting them to VHD in order to do native VHD boot and Hyper-v Virtual Machine.Do you know if this will mess up my licensing of either ? - Anonymous
November 07, 2013
Thanks for sharing, this is really useful stuff.I installed windows 7 ultimate as a vhd to 'bare metal', thinking it was the best way to control my installation frenzy, AND keep my lovely Dell running 'just like new'.Precariously, I followed an excellent guide and, after a couple of scary moments, everything is rocking, just like a physical... except I can see the file that is the operating virtual disk on the actual disk and ... it would protect me from an attempt to delete, right? Not that I ever would, but ... I feel like removing the delete context menu item, might look into that.With this, I presume I need to boot from an install disc, and then go to a command prompt. Is it possible to do it from the f8 command prompt at boot? Or am I already inside the native VHD I'll be attaching and 'Z-modding'? If I wanted a 'dev' disc, making significant changes, can you use this process to attach the differenced disks to the 'multiboot section' (have to look up how to create boot entries for differenced disks)..Thanks again