How To: Convert VHD-bootable Image into Hyper-V VM

How To: Convert VHD-bootable Image into Hyper-V VM

Table of Contents



Scenario

You have a VHD used to boot your PC or server (see Boot from VHD). You need to make this VHD bootable as Hyper-V VM.

Solution

This would not work by default. You will need to execute the following sequence of tasks.

Note: the following sample commands assume that you mount your VHD as disk F:

  1. Turn off the VM (if was running) and mount VHD to some working OS (e.g. your host OS).
  2. Run: bcdboot c:\windows /s f:
  3. Run: bcdedit /store f:\Boot\bcd /set {bootmgr} device hd_partition=F:
  4. Run: bcdedit /store f:\Boot\bcd /set {default} device hd_partition=F:
  5. Run: bcdedit /store f:\Boot\bcd /set {default} osdevice hd_partition=F:
  6. Load “System” registry hive from OS located in VHD (i.e. Regedit -> Load Hive -> select “F:\Windows\System32\Config\System”)
  7. Change startup mode for “IntelIDE” driver from “3” to “0”. (That may be already the case depending on how you OS boots in Boot from VHD scenario).

Conclusion

Using this procedure you should be able to create a dual-boot system that works perfectly both when started with Boot from VHD on real hardware and in Hyper-V VM.


Leave a Comment
  • Please add 8 and 2 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Carsten Siemens edited Revision 8. Comment: Fixed misspellings

  • Richard Mueller edited Revision 7. Comment: Removed (en-US) from title, added tags

  • Pronichkin edited Revision 1. Comment: Added step 2.

  • Ed Price MSFT edited Original. Comment: Added "How to" template.

Page 1 of 1 (4 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Ed Price MSFT edited Original. Comment: Added "How to" template.

  • Pronichkin edited Revision 1. Comment: Added step 2.

  • Excellent

  • Worked for me, thanks -

  • Great Info

    systemcenterconfigurationmanager2012.blogspot.com

  • Richard Mueller edited Revision 7. Comment: Removed (en-US) from title, added tags

  • For UEFI install use F:\EFI\Microsoft\Boot\BCD instead of F:\Boot\BCD

  • BIOS: F:\Boot\BCD

    UEFI: F:\EFI\Microsoft\Boot\BCD

  • Carsten Siemens edited Revision 8. Comment: Fixed misspellings

Page 1 of 1 (9 items)