[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Re: [XCP] converting a .img to xva


  • To: gaudenziFilippo <gaudenzi.filippo@xxxxxxxxx>
  • From: Carsten from Virtastic <carsten@xxxxxxxxxxxxx>
  • Date: Wed, 3 Aug 2011 14:17:26 +0100
  • Cc: xen-users@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 03 Aug 2011 06:18:43 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=virtastic.com; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; q=dns; s= selector1; b=LrwcXD1J7YeGjkgFbkSzsE95F+JfMqX1tvcPFWFbTESapyqQgRI rZJheemNQMbt6vhBPwSofi+Jir9uPY68iQs1TvDMzqdgB++JmMJskY8uul0SlCcd T1ZS2gx5AT5QoRABXL/GVaUstHDNSV5UTh5InneOgYM7TkpkYJNMhaU4=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

Hi there,

> Hi, i have the same problem. 
> Did you resolve it? if Yes, how?

The xva format has got a bit awkward structure. Basically it's a tar file that 
contains loads of numbered files of 1M size each, or an img file cut in 
stripes, if you will.

For example, the tar file would contain:

Ref:xxx/
  00000001
  00000002
  00000003
  ....
  00001029


If one of those stripes consists entirely of zero-bytes, it won't be included 
in the xva.
Names are always just numeric and 8 bytes in length, padded and filled with 
zeros as above.

I've only done the reverse process myself, that is converting xva into img, for 
about 40 VMs. What I've done is:

- unpack tar file
- go into the Ref:xxx folder (xxx is numeric, no idea how that is determined)
- run this very simple script:

================
#!/bin/bash

dd if =/dev/zero of=blank bs=1024 count=1k
test -f image.img && rm -f image.img
touch image.img

max=`ls ???????? | sort | tail -n1`

for i in `seq 0 $max`; do

  fn=`printf "%08d" $i`
  echo -n "$fn of $max"
        
if [ -f "$fn" ]; then
  echo " - appending chunk"
  cat $fn >> image.img
else
  echo " - filling blank"
  cat blank >> image.img
fi
done

rm -f blank

echo 
"Done."
==============

Then I end up with an img file, which works perfectly fine with open source Xen.
Maybe that can help you reverse-engineer it :-)



Cheers
Carsten






_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.