Nathan Stratton’s Homepage

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.

Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • LinkedIn
:

5 Comments for this entry

  • JBill

    How can one convert a img file to xva format ?

  • nathan

    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

  • dr

    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…

  • admin

    Make sure you are root, and add the trailing / after Ref:3, I have tested on Fedora 10 and 11.

    -Nathan

  • Mark Pace

    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

Leave a Reply

Looking for something?

Use the form below to search the site:

Cool Links!

A few highly recommended links...

Archives

All entries, chronologically...