Convert Citrix Xenserver XVA Image to KVM

Tags: , ,

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

  1. Extract the XVA image.

  2. A XVA file is a carefully created tarball we will need to extract.

    mkdir xva_uncompressed
    tar -xf virtual_machine.xva -C xva_uncompressed

  3. Create a raw image

  4. Use xva-img to create a raw disk image from the extracted xva data.

    First we will build xva-img:

    git clone
    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

  5. Convert RAW image to KVM using qemu-img

  6. Install qemu-utils

    sudo apt-get install qemu-utils
    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

  7. Import qcow2 disk image to KVM

  8. Import the qcow2 image to your KVM environment, then attach the image to a VM. In my environment, I use oVirt: