Xen Clone

From ConShell

Jump to: navigation, search

This page describes most of the steps necessary to migrate an existing system into a Xen domainU. The process is still a bit rough around the edges. This example is based on a CentOS-3 system, but should be more-or-less applicable to others.

In this environment LVM is used for the virtual disks, and this fact determines the need to prepare the virtual disk prior to cloning. In a file-backed virtual disk environment, shortcuts could be made but at the cost of performance.

First create the storage (e.g. /dev/mapper/vg01/vol08 or /path/to/some/file) then run mkfs.ext3 on it and mount it as /mnt/disk

Prepwork (on srchost)

Create a file named XenCloneExlude containing these entries:

 proc/*
 tmp/*
 lost+found/
 etc/mtab


Now perform the rsync command as shown. This is just a test (dry) run.

rsync -av -e ssh
 -n \ #dry run
 -S \ # handle sparse files
 -H \ # Preserve hard links
 -W \ # copy files whole
 -D \ # also get device files
 --exclude-from="XenCloneExclude" \
 root@srchost:/ /mnt/tmp

Or, more succintly...

 rsync -av -e ssh  -n -S -H -W -D --exclude-from="XenCloneExclude" root@srchost:/ /mnt/tmp

Post-copy

 scp root@srchost:/dev/MAKEDEV /mnt/disk/dev/
 cd /dev; ./MAKEDEV null random urandom console zero

First run as guest

Now you can exit the chroot and try to boot the vm.

This might be a good time to pull the plug on the old system 8)

Run this command to start the guest with a console attached

 xm create newname -c

(Red Hat et al.) kudzu should run, remove all old devices

 mv /lib/tls /lib/tls.disabled 

Consider reviewing the network configuration.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox


check web page