Daniel Kao
2009-Feb-04 01:47 UTC
[Xen-users] Best way to migrate Xen Disk IMG w/LVM''s to a block-device? (e.g. DRBD)
Hi All, 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 was actually tempted to mount the Xen disk image in a dom0, and make it visible via loop devices and promote that DRBD node for the Xen disk image to primary and flip overwrite-data-of-peer and make DRBD sync it but there must be an easier, faster, safer way. Thanks in advance! -- Daniel Kao Übermind, Inc. dkao@ubermind.com Seattle, WA, U.S.A. +1.206.412.5765 _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Stefan Kögl
2009-Feb-04 08:42 UTC
Re: [Xen-users] Best way to migrate Xen Disk IMG w/LVM''s to a block-device? (e.g. DRBD)
> 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@lists.xensource.com http://lists.xensource.com/xen-users
horacio ibrahim
2009-Feb-04 12:08 UTC
Re: [Xen-users] Best way to migrate Xen Disk IMG w/LVM''s to a block-device? (e.g. DRBD)
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 only = yes 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'' on_poweroff = ''destroy'' on_reboot = ''restart'' on_crash = ''restart'' 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@gmail.com> 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@lists.xensource.com > http://lists.xensource.com/xen-users >-- ITIL: "An industry accepted way of doing something, that works" (Aidan Lawes) _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users