Migrate Windows VM from vSphere to KVM
PreviousMigrate Secondary Linux VM Disk from vSphere to OpenStackNextCustomize VM Instance with Cloud-init
Last updated
Was this helpful?
In this guide, we will migrate a Windows VM from vSphere to KVM.
A vSphere VM with one of the following operating systems (All 64 bit):
Windows Server 2003
Windows Server 2008
Windows Server 2008 R2
Windows Server 2012
Windows Server 2012 R2
Windows 7
Windows 8
Windows 8.1
Windows XP
Administrator privileges for the VM.
The VM must only have one disk.
Since we will modify the VM before converting formats, first clone the VM to keep the original VM intact.

After cloning, power on the new VM. Download the Virtio drivers onto the machine running the vSphere client. Attach the ISO to the VM.

Open the Device Manager on the Windows VM. Then, right click on the root device and select "Add legacy hardware".

Click Next. Then select "Install the hardware that I manually select..." and click Next.

Click Next again. Then, click "Have Disk...". Click "Browse...".

Then, navigate to the directory of the ISO.

Click on "Balloon". Then, select your operating system version. Select the architecture (x86 or amd64). Then, select the INF file (There should only be one of these). Click OK, then Next, and Next again. You may need to confirm the driver installation.

When installing the driver, you may receive an error saying that the device cannot start or is not working properly. This is normal, and the driver should be able to start when the VM boots on a KVM hypervisor.
Repeat the process above for the directories NetKVM, qemupciserial, viorng, vioscsi, vioserial, and viostor.
Ignore errors if the qemupciserial driver complains about the machine architecture.
Finally, install the QEMU guest agent on the VM. The installer is located in the ISO file. Only use the installer that matches your architecture (x86 or x64).

Download the Virtio Registry File onto the VM. Then, open the Windows Registry Editor by searching regedit from the start menu. Click File -> Import...

Then select the Virtio Registry File that was downloaded.
From the control panel, click on "Uninstall a program".

Find the VMware Tools program. Right click on it and select Uninstall. Then, confirm the uninstall.

If prompted to reboot the machine, select Yes.
Download the stable Cloudbase software. Open the installer and click Next until the final the step is reached. Select both the sysprep and the shutdown options. Then, click Finish.

Note the path of the hard disk of the VM by editing the settings of the VM and selecting the Virtual Disk.

Copy the flat VMDK from the ESX host to the Image Library, or a machine with the qemu-img command available.

After copying, convert the VMDK to a QCOW2 image.
For example:
You can simply copy the converted qcow2 image to the Image library host's image directory.


OR
Follow our support guide on Installing OpenStack CLI Clients if the openstack client is not yet installed. Then, use the openstack command to upload the image.
For example:
Create an instance as you normally would. However, for Windows VMs using cloudbase-init, ensure cloud-init is enabled.

Enjoy your newly migrated Windows VM!

Last updated
Was this helpful?
Was this helpful?
qemu-img convert -O qcow2 <input vmdk file> <ouput qcow2 file>qemu-img convert -O qcow2 pf9-win7-copy-flat.vmdk pf9-win7.qcow2openstack image create --disk-format qcow2
--container-format bare
--file pf9-win7.qcow2
--visibility public
--name pf9-win7
--property pf9_description="Windows VM migrated from vSphere"
--property pf9_virtual_size=<size in bytes>openstack image create --disk-format qcow2
--container-format bare
--file
--visibility public
--name
--property pf9_description="Windows VM migrated from vSphere"
--property pf9_virtual_size=26422542336