I have been working through a process to easily convert OpenVZ based machines to KVM/Zen/Vmware machines.
This process does not seem to be well documented.. so I kinda woked it out myself.
It works like this:
- First thing you do is to install a KVM machine with the same operating system. Preferably the same point revision too!
- Now logon to your OpenVZ box and run ‘yum install mingetty’
This will install a load of dependencies - they are all required and provide the core functions to enable your machine to boot successfully!
- Edit the file /etc/inittab and add in the following:
# Run gettys in standard runlevels1:2345:respawn:/sbin/mingetty tty12:2345:respawn:/sbin/mingetty tty23:2345:respawn:/sbin/mingetty tty34:2345:respawn:/sbin/mingetty tty45:2345:respawn:/sbin/mingetty tty56:2345:respawn:/sbin/mingetty tty6
This will enable the machine to actually get a logon prompt!
- Now.. sync the OpenVZ box to the new boxrsync –exclude=/etc/fstab ––exclude=/boot ––exclude=/proc ––exclude=/lib/modules/ ––exclude=/sys -e ssh ––delete –numeric-ids -avpogtStlHz / root@IPTOKVM:/ This will copy every thing from the old box to the new box, but will exclude the kernel files that you will need to boot the machine! Trust me.. it works!
- Power down your OpenVZ Box
- Reboot and start your KVM box.
This process has worked for me pretty much every time when migrating Centos 4.8 and Centos 5.4. I am pretty certain that the same basic idea will work with other distros.