Friday, January 28, 2011

Using a Boot to VHD file in a Hyper-V Server VM

I have a file win7.vhd that I've been using in a Boot to VHD scenario. Now I want to run that Windows 7 instance within Hyper-V Server alongside a few other VMs I have. I sysprepped win7.vhd and copied it over to the the Hyper-V Server and tried creating a new VM using that .vhd file. I get the "Boot failure. Reboot and Select proper Boot device or Insert Boot Media in selected Boot device" error. Any suggestions?

  • When you boot (physically) from a VHD, the boot loader and a few other files reside not within the VHD but on the hosting volume, thus the VHD is incomplete when it stands alone (virtually, within a VM.)

    You can probably fix it up by booting the VM from the Windows 7 installation CD and telling it to repair the boot volume.

    qntmfred : i'm not quite sure what you mean by "booting the VM from the Windows 7 installation CD" could you elaborate?
    Jake Oshins : I meant: Attach the Windows 7 DVD (or an ISO file that contains the same thing) to your VM. Configure the VM to boot from the CD. Press the "start" button on the VM.
  • I was able to successfully boot my vhd in Hyper-V Server using the sequence of commands found at http://www.ravichaganti.com/blog/?p=317

    • Boot into a Windows 7 Installation disc. When the wizard begins, open a command prompt by pressing Shift+F10
    • Open Diskpart
    • Select vdisk file=D:\Win7.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=D:\Win7.VHD
    • detach vDISK
    • Exit
    Jake Oshins : It sounds like you set up your VM to boot from a VHD from within the VM. I was suggesting that you make the VHD itself the boot volume of the VM. Either way, you seem to have what you want.
    From qntmfred

0 comments:

Post a Comment