Converting Citrix .xva to Xen.org .img
by nathan on Jun.06, 2009, under Software
Xen is one of the coolest virtualization technologies out there. It comes in may flavors, the two largest being the bleeding edge xen.org open source project and the commercial (Citrix) version. There are things I love about the commercial version, but they lost me only supporting windows in their XenCenter administration interface.
The file formats of the commercial and open source Xenare totall different. The open source is a standard image file, you can mount it, fdisk it, whatever you would like. The Citrix Xen Virtual Appliance .XVA file is quite different. It is actually a tar file with ova.xml meta data and directories starting with Ref full of 1M files that make up the drive volumes of the virtual image.
To convert .xva to an xen .img file you first untar the image:
tar -xvf {image}.xva
Then grab this handy utility and run it on your untared data, as an example:
python xenmigrate.py –convert=Ref:3 {image}.img
This will paste all of those files back together, starting at 00000000. Note I have had problems running this script on Centos 5.x.
June 8th, 2009 on 10:25 pm
How can one convert a img file to xva format ?
June 9th, 2009 on 4:54 am
Why would anyone want to do that! My guess is that if Citrix wanted to charge for Xen that they would provide some sort of utility for that.
-Nathan
June 18th, 2009 on 6:57 am
Hi nathan,
i get the following error while running the script
when i run python xenmigrate.py –convert=Ref:3 myimage.img
it cannot find the source directory and when i fire
python xenmigrate.py -c xvda image.img
i get the following error
convert ref dir : xvda
to raw file : image.img
Traceback (most recent call last):
File “xenmigrate.py”, line 478, in
reftoraw(opts.convert,args[0],opts.gz)
File “xenmigrate.py”, line 295, in reftoraw
numfiles=int(refdirlist[-2])
ValueError: invalid literal for int() with base 10: ‘chunk-000000002.gz’
Please help…
June 21st, 2009 on 8:24 am
Make sure you are root, and add the trailing / after Ref:3, I have tested on Fedora 10 and 11.
-Nathan
October 29th, 2009 on 7:17 pm
There is a newer version of the xenmigrate program that handles XenServer 5.5 xva files properly. You can get it (and any newer releases that may happen) from its source: http://jolokianetworks.com/Virtualization/Converting_from_Citrix_XenServer_to_Xen_open_source.
Cheers,
pace