qemu-img is a tool apart of the qemu-utils package that lets you convert a wide variety of disk images from one hypervisor to another. However Citrix Xenserver image format XVA is not an option for qemu-img, so lets add it!
Here’s how to convert an XVA image to KVM.
Extract the XVA image.
A XVA file is a carefully created tarball we will need to extract.
mkdir xva_uncompressed tar -xf virtual_machine.xva -C xva_uncompressed
Create a raw image
Use xva-img to create a raw disk image from the extracted xva data.
First we will build xva-img:
git clone https://github.com/eriklax/xva-img.git cd xva-img/ cmake . sudo make install cd ../
Create raw disk image: Note the Ref\:1 may be different.
xva-img -p disk-export xva_uncompressed/Ref\:1/ virtual_machine.raw
Convert RAW image to KVM using qemu-img
Install qemu-utils
#Debian/Ubuntu sudo apt-get install qemu-utils #RHEL/CentOS/Fedora sudo yum install qemu-kvm qemu-img
Covert raw image to qcow2
qemu-img convert -f raw -O qcow2 virtual_machine.raw virtual_machine.qcow2
Import qcow2 disk image to KVM
Import the qcow2 image to your KVM environment, then attach the image to a VM. In my environment, I use oVirt: