So you’ve just captured that last server, you’ve done exactly the same as you’ve done on pervious occasions but this time when you fire up your freshly captured VM you get greeted with a black screen and a lone flashing cursor. You sit and watch this cursor in the hope that it might suddenly remember what it was supposed to be doing and boot the VM, alas it doesn’t and you’re then search the internet for an answer….which is probably how you ended up here.
Ok. I discovered this while trying to grab a Windows 2012R2 Server VM from a Unraid system, which uses KVM hypervisor. The disks are held in IMG files which should be reasonably easy to covert to VHDX using QEMU-IMG from Cloudbase Solutions
I created a generation 2 (this be is important later) and attached the newly covered disks. After firing up the VM I was greeted with this black screen and a single flashing cursor. After a bit of trawling the internet and failing each time I did some more digging.
The crux of the issue here is that the VM was created with a virtual UEFI rather than good old BIOS. This meant when the IMG file was converted the system partition got messed about with. The exact same thing happened when I used Disk2VHD so I am confident these instructions will help people that are capturing physical servers running UEFI.
- First off you need to make sure your using a generation 2 VM, as gen 1 doesn’t support UEFI.
- Next you need to connect a ISO of Windows Server, the same version that is used on the VM. If you don’t have one you can most likely download one from the MSDN Eval center
- Once you have added the ISO boot the VM onto this ISO, this will start the OOB installation process
- On the language screen you can just click “Next”
- Now click on “Repair your computer”
- Click “Troubleshoot” -> “Command Prompt”
- Type: diskpart
- Type list disk and make a not of the number that is your OS disk
- Type select disk 0 change the 0 to the number that matches your OS disk
- Type: list volume and you’ll see that one of the volumes has a file system type of “RAW” and it should be 99Mb as this is the system partition and RAW means that it’s blank…not good.
- Select this volume by typing: select volume 2 again change the 2 to the number that relates to your volume
- Type: assign letter=R
- Type: format FS=FAT32 Label=”BOOT”
- Now exit Diskpart by typing: exit
- Go to R:
- Type the following:
- md r:\efi
- md r:\efi\Microsoft
- md r:\efi\Microsoft\Boot
- Now type:
- bootrec /fixboot
- bcdboot c:\windows /l en-us /s r: /f ALL
- Now you can exit the command prompt and restart the VM
Hopefully now the VM will boot up and you can have yourself a beer in celebration of another good job well done!