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

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



JuanLu,
 
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.
 
xen.conf...
name            = 'myvm'
memory          = '256'
disk            = [ 'tap:aio:/xen/myvm/somefile.img,sda1,w',
                   'tap:aio:/xen/myvm/xen-swap.img,sda2,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?

Thanks
JuanLu

_______________________________________________
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®.