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] Best way to migrate Xen Disk IMG w/LVM's to a block-dev

To: "xen-users@xxxxxxxxxxxxxxxxxxx" <xen-users@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-users] Best way to migrate Xen Disk IMG w/LVM's to a block-device? (e.g. DRBD)
From: horacio ibrahim <horacioibrahim@xxxxxxxxx>
Date: Wed, 4 Feb 2009 10:08:06 -0200
Delivery-date: Wed, 04 Feb 2009 04:08:57 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=AtIZBeMjy9UpZuNY51/TZHOROCWnvirqLafyY0R6dKQ=; b=VnYbjATkMVgGZrNYrsI48EgSuGUw5Av/ovVjEj5hd/cgOzgoiHtEDyEbJMSfDHvAmv AR1awdT7OXylauumUjzHlHHl2wtBY+JYYL9gvAhM6uBDfeJS9TPRZ9f2GGRYXvhD4a0N RbYxaOQrUFNOqpgcgSexEF+gdyrGmQ7iUHNqQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=mnKdiriezBiswpbVFUaT+UdzKPMWO6TW5wCWs9Z7CRaZ4O9kjw+Oa8JnU8M1ZG3sTC X54N4wfY1MvLfBeCgEBvbVZpIeZg1Dkdw7nN9CZQN1WUuMbGwbK9EBQ57sxCWF4uiHUt khFUFGJU0XmKrwFXAETO9ltkSWzFm8T1iYbHk=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <c421ddc60902040042w223a1ae5o23164e4c9c75ecca@xxxxxxxxxxxxxx>
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: <4988F3B8.3040009@xxxxxxxxxxxx> <c421ddc60902040042w223a1ae5o23164e4c9c75ecca@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
You already tried rsync? if applicable

1- Prepare the server physical:
apt-get install rsync

# /etc/rsyncd.conf

max connections = 1
syslog facility = local3
read >list = yes
uid = root
gid = root

comment = physical to virtual server
path = /

rsync --daemon

2- Prepare new DomU (in this case LVM)
File System Root /
lvcreate -L 50G -n vmname.dsk VGxen # as needed

FS swap
lvcreate -L 2G -n vmname.swp VGxen

3- Format e mount
mkfs.ext3 /dev/VGxen/vmname.dsk
mkswap /dev/VGxen/vmname.swp
mkdir /mnt/vmname
mount /dev/VGxen/vmname.dsk /mnt/vmname

rsync -vaH --numeric-ids --stats --progress --exclude "/mnt/*" --exclude "/proc/*" --exclude "/sys/*" --exclude "/tmp/*" --exclude "/var/tmp/*" \
--exclude "/var/run/*.pid" --exclude "/var/run/dbus/system_bus_socket" rsync:// /mnt/vmname/

5 - Finally
5.1 in /mnt/vmname/etc/fstab
# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/xvda1 / ext3 defaults,errors=remount-ro 0 1
/dev/xvda2 none swap sw 0 0

5.2 in /mnt/vmname/etc/inittab:

co:2345:respawn:/sbin/getty 38400 xvc0

5.3 in /mnt/vmname/etc/securetty:


5.4 to create /etc/xen/auto/vmname:

import commands
krn_vers = commands.getoutput('uname -r')

name ='vmname'
builder = 'linux'
disk = [ 'phy:/dev/VGxen/' + name ' + ".dsk,xvda1,w', \
'phy:/dev/VGxen/' + name ' + ".swp,xvda2,w' ]
memory = 512
vif = [ 'bridge=xenbr0' ]
kernel = '/boot/vmlinuz-' + krn_vers
ramdisk = '/boot/initrd.img-' + krn_vers
root = '/dev/xvda1 ro'
>>>extra = 'xencons=xvc console=xvc0 video=tty'
vfb = [ 'type=vnc,vncdisplay=0,vnclisten=,vncpasswd=passwd' ]

6 - copy modules from Dom0 to new DomU
cp -a /lib/modules/$(uname -r) /mnt/vmname/lib/modules/

umount /mnt/vmname

8 -
xm create /etc/xen/auto/vmname -c

source: http://wiki.xen-br.org/index.php?title=P2v-howto

Horacio Ibrahim
On Wed, Feb 4, 2009 at 6:42 AM, Stefan Kögl <koeglstefan@xxxxxxxxx> wrote:
> I was hoping to pick someone's brain about the best way of moving a Xen disk
> image (which has LVM's inside of it) to a new block-device?  I have the
> target DRBD device ready but unsure what's the best & safest way to do it.
I did that once by dd'ing data from all filesystems except for the
root-fs onto the new device from withing DomU, then shutting down the
virtual machine, and copying the root-fs from Dom0. kpartx is your
friend for that ;)



Xen-users mailing list

ITIL: "An industry accepted way of doing something, that works" (Aidan Lawes)
Xen-users mailing list
<Prev in Thread] Current Thread [Next in Thread>