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.
- Windows PE boot files in an ISO format.
- Administrator access to Hyper-V Server the VM is on & the AHV Server.
- 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.
- Click Start, and type deployment. Right-click Deployment and Imaging Tools Environment and then select Run as administrator.
- Create a working copy of the Windows PE files. Specify either x86 or amd64:
“copype amd64 C:\WinPE_amd64”
- Create an ISO file containing the Windows PE files:
“MakeWinPEMedia /ISO C:\WinPE_amd64 C:\WinPE_amd64\WinPE_amd64.iso”.
Installing Nutanix VirtIO Drivers
- Logon to https://portal.nutanix.com with the appropriate credentials
- Click on the Downloads drop down and select Tools & Firmware.
- In the list of the Tools, locate and download VirtIO available as MSI and ISO. Why not download both right?
- 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.
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
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.
- 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
create partition primary
fs=ntfs quick label=spare
- Using imageX, we can use the prepped img versions of the source VM to wim files. The command to do it is
c:\ d:\capture.wim “description of image”
- Now we can recreate the partitions on the new hard drive and proceed. the commands are
create partition primary
fs=ntfs quick label=system
- Image the new HDD with the WIM file created in the steps above using
d:\capture.wim 1 c:\
- Once complete, lets make sure the MBR and sectors are robust.
- 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.
- 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.
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.