Migrating Windows XP Virtual Machine from ESX to KVM

Before converting any Windows Virtual Machine we have to enable IDE in the registry and uninstall VMware tools form VM.

1. Uninstall VMware tools form VM

2. Below is the process to enable IDE in Windows registry.

Login into the VM which you want to migrate, extract the Atapi.sys, Intelide.sys, Pciide.sys, and Pciidex.sys files from the

%SystemRoot%\Driver Cache\I386\Driver.cab file, and copy into the %SystemRoot%\System32\Drivers folder.

Now we will Import new registry settings into windows registry

Open regedit-->Go to file-->Export-->Give a file name-->Click save to save a registry file.

Right Click on saved reg file and click-->Edit-->Open below link-->Copy each line from below link-->Replace copied data into Opened registry file-->Save the registry file

3. Shutdown the VM and Copy VMDK,Flat.VMDK and VMX files to KVM machine.

#scp 10014-1001.vmdk 10014-1001-flat.vmdk 10014-1001.vmx user@KVM Server ip:/var/lib/libvirt/images/

4. Now we will convert .vmx to .xml and .vmdk to .qcow2. We will use vmware2libvirt to convert .vmx file to .xml .

Below command to install virt-goodies in your KVM system.

#apt-get install virt-goodies

5. Convert 10014-1001.vmx to file.xml

#vmware2libvirt -f ./10014-1001.vmx > file.xml

Above command converts the VMware '10014-1001.vmx' file to the libvirt compatible 'file.xml'.

6. Define xml file

# virsh -c qemu:///system define file.xml

Above command imports file.xml into libvirt. The imported .xml files are stored in /etc/libvirt/qemu.

7. Now we will convert .vmdk file to qcow2 format

#qemu-img convert 10014-1001-flat.vmdk -O qcow2 new-diskname.qcow2

Now we have converted .vmx to .xml and .vmdk to .qcow2 file, we need to edit VMNAME, OS Arch & Disk name or source file name in xml file. Please find below is the sample of a xml file. Open the converted xml file and Change VM name as you want, change "type arch" to x86_64, change source file name.

Below command will open file.xml to edit.

#virsh edit file.xml

In the above XML you can see my disk is pointed new-diskname.qcow2 which we have converted to qcow2 format.

Note:While vmware2libvirt works well on simple virtual machines, there are limitations because .vmx files don't always contain enough information, and also because vmware2libvirt tries not to make too many assumptions about what it finds. A couple of things to look out for: While vmware2libvirt attempts to detect a 64-bit guest, be sure that your 64-bit guest has in its .xml file:


vmware2libvirt only detects and uses the first ethernet interface found. Additional interfaces can be added from within virt-manager.

Currently the first scsi disk is used if found, otherwise the first ide disk. Additional disks can be added from within virt-manager.

The converted virtual machine is hard-coded to use 1 cpu. This can be changed with:


8. Define the xml file and start the VM.

#virsh -c qemu:///system define file.xml

#virsh start vmname

Above command imports file.xml into libvirt. The imported .xml files are stored in /etc/libvirt/qemu.Next command will start VM.

No comments: