[CentOS] Migrating standalone systems to xen guests

Fri Mar 4 09:57:28 UTC 2011
Simon Matter <simon.matter at invoca.ch>

> On Fri, Mar 04, 2011 at 10:31:18AM +0200, Jussi Hirvi wrote:
>> Is there any (easy?) way to migrate running standalone CentOS 4 or 5
>> systems to xen virtual stacks?
>>
>> Rebuilding those systems from scratch on the xen machine would take
>> plenty of work.
>>
>
> If you're talking about Xen PV domUs, then the process
> is pretty much like this:
>
> - ssh into the standalone system.
> - make sure /etc/modprobe.conf includes xenblk driver (so that it'll be
> included in the generated initrd when you install kernel-xen).
> - fix /etc/fstab to have xvd* (xen virtual disk) devices instead of sd*.
> - install kernel-xen rpm.
> - verify kernel-xen is the default in /boot/grub/grub.conf.
> - verify root= parameter is correct in /boot/grub/grub.conf for
> kernel-xen.
> - copy/transfer all the files from the standalone system to virtual
> disk/image.

Make sure here to copy with preserving hardlinks, use tar or rsync -aH for
this. And, you can exclude some content like /dev/* (but not the directory
/dev itself!).

> - create a configuration file for the new domU, make it use pygrub
> bootloader, and make it use xvd* disks/devices.

Also, you may have to adjust network config.

> - done.

And, if something goes wrong, you can simply loop mount the filesystem on
the Xen host and fix things, maybe chrooting before depending on what you
do.

Simon