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.

Building

$ svn checkout https://github.com/eriklax/xva-img.git
$ 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.

Usage

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.