Build and use xva-img to extract raw images


Prior to version 6.0, one of the export options for XenServer was the XVA format. It’s essentially a tar archive with disks stored as 1MiB stripes.

Among others, the xva-img tool by eriklax can be used to convert images from XVA to raw. It’s not in any major package manager, so we need to build it.


$ svn checkout
$ cmake .
# make install clean

Which returned this:

fatal error: openssl/sha.h: No such file or directory
 #include <openssl/sha.h>

Well then, I don’t have the OpenSSL developer libraries. I had to look this up for Debian/Ubuntu, but it’s:

# apt-get install libssl-dev

Now you should be able to build and install as normal. If you’re interested, I’ve thrown together a quick gist.


Xen xva files are tar files, with the original images spliced into 1MiB files. So the first step is to extract it:

# tar -xf [image].xva

You’ll see a series of referenced image folders, such as “Ref:2154″. So to use the tool to convert to a raw image:

root@apt-yum:~# xva-img -p disk-export Ref\:2154/ disk.raw

I got the following error:

Exporting: |=====================                                        \ ERROR
xva-img: cannot add empty chunk to disk.raw

Because xva image is sparse, converting to raw expands it to the full size. I accounted for double the size of the original image, but I really needed space for the entire uncompressed image.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.