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

Re: [Xen-users] Best way to migrate Xen Disk IMG w/LVM's to a block-device? (e.g. DRBD)


  • To: "xen-users@xxxxxxxxxxxxxxxxxxx" <xen-users@xxxxxxxxxxxxxxxxxxx>
  • From: horacio ibrahim <horacioibrahim@xxxxxxxxx>
  • Date: Wed, 4 Feb 2009 10:08:06 -0200
  • Delivery-date: Wed, 04 Feb 2009 04:08:57 -0800
  • 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=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

You already tried rsync? if applicable

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

1.2
# /etc/rsyncd.conf

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

[p2v]
comment = physical to virtual server
path = /

1.3
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

4-
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://192.168.1.123/p2v/ /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:

xvc0

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=0.0.0.0,vncpasswd=passwd' ]

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

7-
umount /mnt/vmname

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


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

Att,
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 ;)

Regards,

Stefan

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



--
ITIL: "An industry accepted way of doing something, that works" (Aidan Lawes)
_______________________________________________
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®.