Answered by:
VHD to Hyper-V Virtual Machine

Question
-
Hi
I have Installed Windows 7 in VHD from my Windows 200 Server R2 and booting this machine natively.
Is it possible to use this VHD [Windows 7 installed inside] in Hyper-V virtual machine?If yes how can I use it?
Thanks
Manoj
http://www.youtube.com/watch?v=glVHqGKEL4sMonday, January 23, 2012 4:37 PM
Answers
-
Without knowing more about the vhd file (or what steps you took to install windows7), from your description I understand that the vhd file was used to boot the physical server.
In that case the boot information about the Windows7 location is probably stored in the BCD configuration on the physical hard drive. That means that the vhd file does not contain an active boot partition, as the computer boots on physical hard drive that simply points out the vhd file.
As a first step you should mount the vhd using another machines disk manager and activate the partition using diskpart. You might even have to try the bootsect.exe command (available on win7 installation DVD in the "boot" directory) to add BCD information. Then boot the VM with Win7 media and run the startup repair utility.
I can't say that this will fix make the vhd file bootable, you might have to add the BCD information about the currently installes OS manually.
Note that if this was a problem involving storage drivers, you would've recieved a stop error. In your case the vhd file is not attempting to boot at all.
- Proposed as answer by Vincent Hu Tuesday, January 24, 2012 4:17 PM
- Marked as answer by Jangid Wednesday, January 25, 2012 2:39 PM
Tuesday, January 24, 2012 12:31 PM -
- Marked as answer by Jangid Wednesday, January 25, 2012 2:39 PM
Wednesday, January 25, 2012 11:39 AM
All replies
-
Hi!
You could copy the vhd file to your Hyper-V server, create a new virtual machine and attach the vhd file in the VM settings.
- Edited by Mike_Andrews Monday, January 23, 2012 4:49 PM
- Proposed as answer by BrianEhMVP Monday, January 23, 2012 8:06 PM
Monday, January 23, 2012 4:49 PM -
I did, every time I am getting boot failure error :(
check this image
If I attach any other VHD, they are working fine
http://www.youtube.com/watch?v=glVHqGKEL4sTuesday, January 24, 2012 11:17 AM -
Hi,
check that the .vhd file was attached to IDE0 controller in the VM Setting
Best RegardsTuesday, January 24, 2012 12:16 PM -
Without knowing more about the vhd file (or what steps you took to install windows7), from your description I understand that the vhd file was used to boot the physical server.
In that case the boot information about the Windows7 location is probably stored in the BCD configuration on the physical hard drive. That means that the vhd file does not contain an active boot partition, as the computer boots on physical hard drive that simply points out the vhd file.
As a first step you should mount the vhd using another machines disk manager and activate the partition using diskpart. You might even have to try the bootsect.exe command (available on win7 installation DVD in the "boot" directory) to add BCD information. Then boot the VM with Win7 media and run the startup repair utility.
I can't say that this will fix make the vhd file bootable, you might have to add the BCD information about the currently installes OS manually.
Note that if this was a problem involving storage drivers, you would've recieved a stop error. In your case the vhd file is not attempting to boot at all.
- Proposed as answer by Vincent Hu Tuesday, January 24, 2012 4:17 PM
- Marked as answer by Jangid Wednesday, January 25, 2012 2:39 PM
Tuesday, January 24, 2012 12:31 PM -
Thanks Andrews for response,
I'll try according to you, now one more question.
Now you know I am using this VHD to boot Windows 7, Does this VHD will work after using in Hyper-V?
My main objective is I don't want to reboot my machine to change the OS, I want two option to boot my machine and finally I want to distribute this VHD to my other servers, might be this will raise some question for you.Thanks
Manoj
http://www.youtube.com/watch?v=glVHqGKEL4sWednesday, January 25, 2012 10:58 AM -
- Marked as answer by Jangid Wednesday, January 25, 2012 2:39 PM
Wednesday, January 25, 2012 11:39 AM -
brilliant :) exactly what I was looking
http://www.youtube.com/watch?v=glVHqGKEL4sWednesday, January 25, 2012 2:39 PM -
When we connect a VHD directly to a VM in Hyper-V
environment, it simply won’t boot because there is no Boot Configuration Data
within the VHD. Now, to be able to use this VHD in a Hyper-V VM, we need
complete a few more steps.We need to make the primary partition within the VHD “active”.
To do this
- Open Diskpart in elevated command prompt:
c:\windows\system32>diskpart.exe
Select vdisk file="path to your VHD.vhd"
Attach Vdisk
select part 1
active
Assign letter=v
exit
- Now, at the command prompt, change to v:\Windows\System32:
v:
cd/windows\system32 ( you should see: v:\windows\system32> )
BCDboot.exe v:\Windows /s v:\
BCDedit /store v:\boot\BCD /set {bootmgr} device boot
BCDedit /store v:\boot\BCD /set {default} device boot
BCDedit /store v:\boot\BCD /set {default} osdevice boot
- Change directory to C:\
c:
- open Diskpart again and run
Select vdisk file="path to your VHD.vhd"
detach vDISK
Exit
Now start your VM and go on..
Wednesday, October 8, 2014 1:07 AM