If you try to run a physical-to-virtual (P2V) conversion on a Windows Server 2012 R2 machine with UEFI, you’ll receive the error “There is no BCD boot device found in the source machine, noticing that the conversion of an EFI boot machine is currently not supported.” In this article, I’ll show you how to bypass that error by converting the server to a VM with Disk2vhd and how to repair the boot record so you don’t get a black screen with a blinking cursor.

Recently, I needed to convert a physical Windows Server 2012 R2 server to a virtual machine (VM). When the server was deployed, it was configured with UEFI. I downloaded the Microsoft Virtual Machine Converter and ran through the process to start the conversion of the machine after hours. When I got to the very end of the wizard, I received this error: “Microsoft Virtual Machine Converter encountered an error while attempting to convert the virtual machine. Details: There are blocking issues for the physical-to-virtual conversion: There is no BCD boot device found in the source machine, noticing that the conversion of an EFI boot machine is currently not supported.”

Microsoft Virtual Machine Converter encountered an error while attempting to convert the virtual machine

Microsoft Virtual Machine Converter encountered an error while attempting to convert the virtual machine.

Unfortunately, the Virtual Machine Converter doesn’t support P2V conversions for UEFI computers with GPT disks such as this server. Backing up all the data and performing a full server migration is an option. However, this particular server just had the application on it upgraded. In addition, a full migration would have been very time consuming, especially considering that the specialty application required hours of vendor assistance to install.

Convert the disk to VHDX

The first thing that we need to do is convert the physical disk to VHDX. A great Sysinternals tool from Microsoft called Disk2vhd will perform this task. Download Disk2vhd and extract the executable on the server that needs to be converted. Run the application, set the location where you want the VHDX file stored, and click Create.

Convert the disk to VHDX using Disk2vhd

Convert the disk to VHDX using Disk2vhd.

For the VHD file name, I used a UNC path to a temporary storage location that had enough storage to store all the data from the server. After the process completes, transfer the VHDX file to a Windows 8+ workstation.

Convert the disk from GPT to MBR

Next, we’ll need to convert the disk from a GPT disk to an MBR disk. A few different ways exist to do this (including the built-in tools in Windows), but I’ve found that using AOMEI Partition Assistant is, by far, the most reliable way to perform the conversion. In most cases, the Standard edition (that is free) can do everything you’ll need as long as you run it from Windows 8+ and not a server. If you’re working with very large partitions, you may need to pay for the Professional edition.

Using a Windows 8+ computer, mount the VHDX file by right-clicking it and choosing Mount.

Mount the VHDX file in File Explorer

Mount the VHDX file in File Explorer.

Make note of the drive letter that is assigned to the disk after it is mounted. In my case, it was H:\.

View the mounted VHDX file as a drive letter in File Explorer

View the mounted VHDX file as a drive letter in File Explorer.

Next, open AOMEI Partition Assistant and find your disk. Right-click the disk where it shows Disk Number (GPT) and then choose Convert to MBR Disk.

Convert GPT disk to MBR in Partition Assistant

Convert GPT disk to MBR in Partition Assistant.

Accept the warning messages and then click Apply in the upper-left corner to apply the changes. Next, right-click each of the extra partitions at the beginning of the disk and choose Delete Partition.

Remove extra partitions in Partition Assistant

Remove extra partitions in Partition Assistant.

Choose the default option, Delete partition quickly, and then click OK for each. Click the Apply button one last time to apply the change. After the process completes, close Partition Assistant.

Last, you’ll need to disconnect from the VHDX file. Go to File Explorer, right-click the mounted VHDX file, and choose Eject.

Eject the VHDX file in File Explorer

Eject the VHDX file in File Explorer.

Create the new virtual machine

In Hyper-V Manager, run through the normal steps to create a new VM. When creating the VM, make sure that you choose a Generation 1 VM and, instead of creating a new VHDX file, attach the file that was generated by Disk2vhd that we’ve edited.

Assuming you’ve done everything correctly so far, you should be greeted by a black screen with a blinking cursor if you attempt to start the VM that never boots into Windows.

Disk2vhd converted Server 2012 R2 with blinking cursor that won't boot

Disk2vhd converted Server 2012 R2 with blinking cursor that won't boot

Repair the virtual machine

To repair the VHDX so it will boot into Windows Server 2012 R2, we’ll need a Windows Server 2012 R2 install ISO image. Attach the ISO to the VM and boot from the ISO/virtual DVD drive. On the first Windows Setup screen, click Next, and then click the Repair your computer link.

Windows Server 2012 R2 Setup Repair your computer

Windows Server 2012 R2 Setup Repair your computer

Click the Troubleshoot option and then click Command Prompt.

Command Prompt in Advanced Options of Troubleshooting

Command Prompt in Advanced Options of Troubleshooting

Next, we’ll use diskpart to make the partition on the VHDX active. At the command prompt, run the following commands:

diskpart 
list disk 
select disk 0 
list partition 
select partition 1 
active 
exit

Use diskpart to make the partition active

Use diskpart to make the partition active.

Depending on your configuration, you may need to adjust the disk and partition numbers. After setting the partition as active, reboot the VM and boot to the Windows Server 2012 R2 setup ISO again. Run through the same process we used in the last step to get to the command prompt again.

Next, we’ll use bootrec to make the VHDX bootable. At the command prompt, run the following commands:

bootrec /fixmbr 
bootrec /fixboot 
bootrec /rebuildbcd

Use bootrec to make the VHDX bootable

Use bootrec to make the VHDX bootable.

After the final command completes, you’ll be asked if you want to add the installation to the boot list. Type “y” and press Enter. Detach the Windows Server 2012 R2 ISO and reboot the system.

Boot Windows Server and clean up

After rebooting, you should be greeted by a familiar-looking boot screen while Windows adjusts to its new virtual hardware.

Windows Server 2012 R2 Getting devices ready after Disk2vhd and repair

Windows Server 2012 R2 gets devices ready after Disk2vhd and repair.

The last thing we’ll need to do is some cleanup of things the physical server needed that the virtual server won’t need. Open Device Manager and click View, then Show hidden devices.

Show hidden devices in Device Manager

Show hidden devices in Device Manager.

When you expand the different hardware sections in Device Manager, you should now see phantom hardware that has a lighter icon than the existing hardware.

Phantom physical hardware in Device Manage for P2V system

Phantom physical hardware in Device Manage for P2V system

For each of the phantom pieces of hardware, you’ll need to right-click and choose Uninstall to remove it.

Next, you’ll need to go to Program and Features in the Control Panel and remove any vendor-specific software such as NIC teaming tools or hardware management software. Once you’ve done that, reboot the server, re-attach the network adapter to the network, and you’re ready to use your new VM.

avataravatar
55 Comments
  1. Peter 6 years ago

    Been working on this on an off for months. Lots of articles out there about making Windows 10 systems bootable but foundered on the whole EFI partition. Got it working at last with this article, so thank you.

  2. Felipe Kich 6 years ago

    Hi Kyle. I tried Microsoft Converter 3.0, and when it threw that error about GPT disks, I stumbled upon this article, which is great by the way, but I tried to follow a simpler route, which worked flawlessly, just thought about sharing here.

    I used SysInternals’ Disk2VHD to create a VHDX disk from the physical server. Next, I created a Generation 2 VM in Hyper-V, attached the VHDX and the WS2012R2 ISO. Upon booting the VM from the ISO image, I opened the recovery console, and did the following:

    Assigned a letter to the System partition (e:), formatted it as FAT32 (in my VHDX, the partition appearead as RAW), then copied the files from the Windows folder:

    Bcdboot C:\Windows /l pt-br /s e: /v /f UEFI

    Then used Bootrec to rebuild the BCD:

    bootrec /fixboot

    bootrec /rebuildbcd

    Restarted the VM, and there was my server, up and running. No need to mess arround with partitions, disk conversions, and all.

    Just my 2 cents.

    Regards.

    avatar
    • Kristof 4 years ago

      How can I write on VM console gen 2? I can't write in console after ctrl+alt+left arrow and I read that VM gen2 hasn't keyboard drivers. Can you fix it?

  3. Omar 6 years ago

    can we convert GPT  to MBR larger than 3TB…

  4. Sam 6 years ago

    Another thankyou 🙂

  5. Murambi 6 years ago

    Kyle, thanks a lot. Worked like a Charm! This ought to be on the official technet page.

  6. mac 6 years ago

    thank you very much!

  7. Amos 6 years ago

    Thanks. This one saved me.

    ThumbsUp!!

  8. Nick 6 years ago

    Thanks Felipe,

    Your process only took a few minutes to do and worked perfectly. VM is up and running.

  9. Ivan 5 years ago

    Big thank you! Migration worked like a charm.

  10. Mackoy1 5 years ago

    got stuck with “getting devices ready” does it realy take time?

  11. MK 5 years ago

    I see that you strip out the System Reserved Parition.  Is that correct?  If I have an option to not include it in the vhdx, should that route be taken off the bat?

    Thanks!

    Mike

  12. GCRaistlin (Rank 1) 5 years ago

    MK

    All you need is the data partition. BCD can be stored there without any issues, all the more on VM.

    These steps are actually superfluous:

    bootrec /fixboot

    bootrec /fixmbr

    Also, an expandable volume is OK.

  13. Casey 5 years ago

    Excellent article.  Like many other commenters, I’d spent hours searching for the magic combination of DISK2VHD, GPT to MBR, and finally making it all bootable as a “Generation 1” Hyper-V VM guest.

    The reminder to clean up Device Manager, remove manufacturer-specific software, and such, was just icing on the cake.

    Thank you!

  14. Naveed 5 years ago

    Gream Man! Perfect guider

    Works like a Charm.

  15. Hector Vitela 5 years ago

    Thanks Kyle, excellent article. Regards from Monterrey, Mexico.

  16. Ross Aveling 4 years ago

    A simpler way to P2V from a UEFI/GPT server to a Hyper-V Gen 2 VM.

    1. Disk2VHD the physical server.  I choose the Recovery partition and C drive.  Use VHDX format
    2. Shutdown physical server.  Prevents further updates not captured in the VHDX
    3. Create new Gen 2 VM in Hyper-V.  Leave virtual NICs "Not connected"
    4. Attach new VHDX and Windows Server ISO.  I used 2012R2 as booting 2012 (the same version as the physical server) wouldn't recognise keyboard input
    5. Boot VM to ISO and drop to command prompt (Repair Computer > Troubleshoot > Command Prompt)
    6. Run DISKPART
    7. Select Disk 0
    8. Select System Partition (for me, this was partition 2)
    9. You'll notice the partition is listed as RAW having been mangled by Disk2VHD.  Format it to FAT32 by running format fs=fat32 in DISKPART
    10. Assign a driver letter to the System partition; assign letter=P
    11. Exit DISKPART
    12. Run bcdboot C:\Windows /l en-gb /s P: /f UEFI (changing the locale as appropriate)
    13. Reboot
    14. Windows will take longer to boot as it figures out all the new virtual hardware devices
    15. Log in and clean up the VM as needed; hidden devices, server management tools etc and define network card parameters
    16. Test thoroughly
    17. Connect the VM's network adapter to the appropriate virtual switch and reboot the VM

    I didn't need to disable Secure Boot at any point or run bootrec

    avatar
    • NazX 3 years ago

      wink Lovely!

      • NazX 3 years ago

        But I noticed it removed BitLocker that was enabled on the OS drive!

  17. MTPC 4 years ago

    Can you delete the erroneous drive you created in this? or should you leave it in tact?

  18. Valens 2 years ago

    Oh my god, I’ve been searching for this for 2 days. I couldn’t be able to find a way to virtualize the hosts on a chassis. Had the idea to see if ws2012r2 installation image can see the partitions and i ran into GPT error.

    Thank you for the article.

  19. Alex 8 months ago

    I also spent many hours to finally make Windows Server 2012 R2 work in a VM in combination with disk2vhd, GPT and UEFI. Tried many other articles, only your article worked! I didn’t encounter any problems following your instructions!

    Thank you very much!

Leave a reply to NazX Click here to cancel the reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account