Home » Acropolis » Converting Hyper-V UEFI VM to BIOS VM on Acropolis HV

Converting Hyper-V UEFI VM to BIOS VM on Acropolis HV


My first post since joining Nutanix. Its been pretty hectic in my new role and I am loving it. There is so much to learn and there are so many awesome things coming up; its hard to keep abreast of everything.

One of the best reasons to choose Nutanix is CHOICE. Choice of running the Hypervisor you want not the one that you are forced to live with. For many people today the hypervisor of choice is still VMware ESXi and rightly so. But Microsoft hasn’t been quiet with Hyper-V. Hyper-V is almost at feature parity with ESXi now but is still considered second best. At Nutanix, we have our own hypervisor called Acropolis Hypervisor (What a great name), its based on KVM but has been through the hands of our very capable Product Development team, who have ironed out all the issues.  We also strive to enable our customers to change hypervisors when they want to; be it from AHV to ESXi or Hyper-V to AHV. This blog post focuses on how to convert a Hyper-V UEFI VM such as Windows 2008 R2 or higher to traditional BIOS VM on AHV.

But first lets look at the pre-reqs for doing such conversion.

Pre-Requisites

  1. Windows PE boot files in an ISO format.
  2. Administrator access to Hyper-V Server the VM is on & the AHV Server.
  3. Nutanix VirtIO drivers (either in ISO format or can be pre-installed on the VM thats to be converted)

Preparing the Win PE environment 

Now that we know what we need, lets see how to configure them. To create Windows PE you will need to head to the MSFT website here and download it. Once downloaded and installed, follow these steps to create the ISO.

  1. Click Start, and type deployment. Right-click Deployment and Imaging Tools Environment and then select Run as administrator.
  2. Create a working copy of the Windows PE files. Specify either x86 or amd64:
    “copype amd64 C:\WinPE_amd64”
  3. Create an ISO file containing the Windows PE files:
    “MakeWinPEMedia /ISO C:\WinPE_amd64 C:\WinPE_amd64\WinPE_amd64.iso”.

Installing Nutanix VirtIO Drivers 

  1. Logon to https://portal.nutanix.com with the appropriate credentials
  2. Click on the Downloads drop down and select Tools & Firmware.
  3. Tools_FirmwareIn the list of the Tools, locate and download VirtIO available as MSI and ISO. Why not download both right? VirtIO
  4. Once you have downloaded the drivers, it is recommended that you install them before you start the process for VM conversion.

At this point, lets take a walk down ITIL road and ensure that we have all the outages / change requests etc all scheduled and approved. Because for the next steps, you will need to shutdown the VM at the source. It would also be wise to ensure that a known good backup of the VM is available just in case.

Conversion Process

First of all, I want to call out the source for this process. I found this article by Dominique Yeung about converting UEFI to BIOS on KVM and am crediting this section of the blog post to him. I added the specifics around AHV but the core is still what Dom says. In fact I used it to do a conversion before I started this post. Blog with integrity !! I can’t emphasise on it enough !!

  • Logon to your Windows VM and capture all the details of Drive Letters, Partitions, Network Details etc.
  • Shutdown the VM and import all the hard disk files into AHV. (blog about this coming up soon)
  • KVM only supports hard disks of fixed sizes so the files should be .vhd or .vhdx format only. If they aren’t, there are tools within Hyper-V Mgr to convert them.
  • Using standard Nutanix AHV tools (KVM qemu tools), convert all the GPT disks to .img files using the command

 ‘sudo qemu-img convert -p <name>.vhdx -O raw <name>.img', where name is the name of the hard disk file. 

  • Create a new VM using PRISM, Click ‘Create VM’. The following window appears. Fill up the details exactly as per the original VM. CreateVM
  • Click on the pencil icon next to CDROM, select Operation drop-down and choose CLONE FROM IMAGE SERVICE. Leave the bus type as IDE and select the WinPE.iso file that you created earlier.
  • Create all the hard disks required by clicking on +New Disk. Ensure that you have more than or equal to the hard disk sizes not considering thin provisioning. So if your source VM had 3 disks with 40, 60,60 GB sizes, you only need to create one disk. We will add the data disks at the end of the process.
  • We also need to create a spare disk for C drive of the VM. So create one more disk with 60 GB (use the size of your biggest disks). This is deleted after the conversion process and unused storage is reclaimed back into the storage pool.
  • Now boot into Windows PE environment.
  • Using diskpart, we will format the spare disks into NTFS and create the primary partition. The commands are
diskpart
select disk 1 
create partition primary
format fs=ntfs quick label=spare
assign
exit
  • Using imageX, we can use the prepped img versions of the source VM to wim files. The command to do it is

imagex /capture c:\ d:\capture.wim “description of image”

  • Now we can recreate the partitions on the new hard drive and proceed. the commands are
diskpart
select disk 0
clean
create partition primary
format fs=ntfs quick label=system
assign
active
exit
  • Image the new HDD with the WIM file created in the steps above using

imagex /apply d:\capture.wim 1 c:\

  • Once complete, lets make sure the MBR and sectors are robust.
BootRec.exe /fixmbr
bootsect.exe /nt60 all /force
BootRec.exe /rebuildbcd
bcdboot.exe c:\windows /l en-us
  • Once done, shutdown and remove the spare disk and unmount the WinPE ISO.
  • Attach the VirtIO iso file download to a new CD ROM device and start up the Windows Server on AHV.
  • Once everything comes back up, you can attach the data drives to the VM following the same procedure as attaching a CD ROM except for choosing the disk option and selecting CLONE FROM NDFS FILE and selecting the .img file.

Troubleshooting

  • If you are having trouble finding the boot drive, boot into WinPE and try fixing the MBR.
  • If VM crashed trying to boot, sorry go back to the start of the conversion process and start again.
  • VM has booted but you can ping anything: You didn’t add a NIC in the steps above, so please add one.
  • Data disks are not appearing: Open Device Manager, select all devices listed under “Other Devices” and update the drivers. The updated drivers are found on VirtIO iso file.

 

Conclusion

I have tried this process and it works. Having said that, this process is not affiliated in any way or form by Nutanix. So try it at your own risk. Like anything ensure you have a good backup or may be use a test server first rather than that critical Tier 1 Server.

 

Adios.


Leave a comment

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

Koodzo

Check Out koodzo.com!

Categories

Archives