WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Clone self-contained domU's

Subject: Re: [Xen-users] Clone self-contained domU's
From: Thomas Goirand <thomas@xxxxxxxxxx>
Date: Fri, 23 Jan 2009 00:57:27 +0800
Cc: xen-users <xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 22 Jan 2009 08:59:01 -0800
Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=goirand.fr; h=message-id: date:from:mime-version:cc:subject:references:in-reply-to: content-type:content-transfer-encoding; q=dns/txt; s=postfix; bh= 5gWtyIoCljHsWnRG/gJKvJSEsYU=; b=nLoGpgraOyh+48gAh1TdXvp74OpkOV3W eVyRPmWp9UNeeYsjSD8JUgPBm7h7brb0tS5TFXC1fE5b96/KnjPbB8+T+mPpXjJL YuqOu244NDkWL4DwhQPpnKQBVyxuuQ55TvIz/2HbySGcfyrwmV8jmk8tZ2bIoKZM h6WZaqARTu0=
Domainkey-signature: a=rsa-sha1; c=nofws; d=goirand.fr; h=message-id:date:from:mime-version:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=postfix; b= U4N3xWJwS4C6wfZCKxIRPi0Z6i3MXfxwgd1zfe9RRwEx0f44q0CnS2sW0tYonJkW 0inUwoHUO1FVIbb/v57wOdffXWWZ+JRY1dNRQ+0/9QZ88fx11b0EwovQZUkuAcR3 zOBy0b/I3u8TPKPVeBPFPfZt08yMe0qtxlY7Z7yreSw=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <49788830.6030600@xxxxx>
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>
Openpgp: id=98EF9A49
Organization: GPLHost
References: <49788830.6030600@xxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)
Ferreira, N. L. (Nuno) wrote:
> Dear *, again
> 
> My goal:
> install a PV self-contained guest (i.e. kernel on domU with guest config
> file using pygrub as bootloader) inside LVM logical volumes on dom0, and
> use it as a pristine template for other VM's
> 
> What I did till now, just for reference (LVM already in place as well as
> needed LV's) :
>      domU installation
> 1 - virt-install -n vm1 --nographics -p -f  /dev/vgxen/vm1 -l
> http://..... -r 1024
> 2 - xm create -c vm1 [runs ok]
> 
>    domU tweekings (with Fajar's help)
> 1 - xm shutdown vm1
> 2 - kpartx -av /dev/vgxen/vm1
> 3 - mount /dev/mapper/vm1p1 /mnt/vgxen/vm1
> 4 - cd /mnt/vgxen/vm1; and tweek things here
> 5 - cd; umount /mnt/vgxen/vm1
> 6 - kpartx -dv /dev/vgxen/vm1
> 
> 
> So far so good.
> And now here's my naive question.
> What's the best way to clone this self-contained domU, and populate
> another, say, logical volume?

# This creates a new VPS with space for 25G
# note that your template vm1 should be smaller
# than the target vm2
lvcreate -L25G -nvm2 vgxen
cat </dev/vgxen/vm1 >/dev/vgxen/vm2
fsck.ext3 -f -y /dev/vgxen/vm2
resize2fs /dev/vgxen/vm2
mkdir -p /mnt/vgxen/vm2
mount -t ext3 /dev/vgxen/vm2 /mnt/vgxen/vm2
<tweaks (change IP adddress, hostnames, etc.)>
umount /mnt/vgxen/vm2

then create the xen startup file in /etc/xen and xm create...

Thomas

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

<Prev in Thread] Current Thread [Next in Thread>