This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


RE: [Xen-users] Create a guest image from compress tar.gz

To: <juanluis.prietomartinez@xxxxxx>, <xen-users@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-users] Create a guest image from compress tar.gz
From: "Gary W. Smith" <gary@xxxxxxxxxxxxxxx>
Date: Wed, 18 Feb 2009 09:10:32 -0800
Delivery-date: Wed, 18 Feb 2009 09:11:25 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <9B76EE945BA27E43B331031206AF943A04C6A25F@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcmR6jtrd5J5HGPtQhG6VimquoiW8AAAGczr
Thread-topic: Create a guest image from compress tar.gz
We do it exactly just like you said...
Is here how:
* Create a disk image (dd if=/dev/zero of=somefile.img bs=1 count=1 seek=8G)
* Format disk image (mkfs.ext2 somefile.img)
* Mount disk image (mount -o loop somefile.img looppoint)
* Copy your files (tar -zxSf yourtarballingzformat -C looppoint)
* Unmount your loop (umount loop)
* Create your swap file (if you want) (dd if=/dev/zero of=xen-swap.img bs=1M count=256) <-- no sparse file for this...
* Create your xen.conf file for that image.
name            = 'myvm'
memory          = '256'
disk            = [ 'tap:aio:/xen/myvm/somefile.img,sda1,w',
root            = '/dev/sda1 ro'
vif             = [ 'mac=00:16:3e:22:10:f8,bridge=eth0' ]
on_reboot       = 'restart'
on_crash        = 'restart'
vcpus           = 2
kernel          = "/xen/centos_boot/vmlinuz-2.6.18-92.1.18.el5xen"
ramdisk         = "/xen/centos_boot/2.6.18-92.1.18.el5xen.img"
Please note that I'm running this under FC8 but booting the domU with CentOS kernel (thus the ramdisk/kernel).  That is probably the only thing you will need to change and get additional advice on. 
Two things to note. 
* Whatever kernel you boot the domU in is what you need the lib files for (copied into the vm).  This simplifies things.  You could roll your own domU kernel which some people have been doing.  I'm using this one since we are doing development specific to CentOS.
* Think up a file naming convention that suites you.  We use /xen/vmname/xen-D[x].img (where x is the disk number starting at zero) for the files (except swap which is names xen-swap.img).

From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx on behalf of juanluis.prietomartinez@xxxxxx
Sent: Wed 2/18/2009 8:59 AM
To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] Create a guest image from compress tar.gz

Hi all,

My issue is that I want to create a XEN image starting from a tar.gz that contains all the files and folders of the hard drive of the computer I want to "clone", i. e., all the root (/) of a hard drive compress in a tar.gz file.

I've been looking for this type of info of how to do it on the web and I couldn't find anything that makes this process.

  • Have you ever done this?
  • Which are the steps to follow?


Xen-users mailing list
<Prev in Thread] Current Thread [Next in Thread>