How to migrate OpenVZ to KVM/VMWare

To migrate your OpenVZ virtual server to a KVM/VMWARE just follow these steps:

  • 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 runlevels

    1:2345:respawn:/sbin/mingetty tty1
    2:2345:respawn:/sbin/mingetty tty2
    3:2345:respawn:/sbin/mingetty tty3
    4:2345:respawn:/sbin/mingetty tty4
    5:2345:respawn:/sbin/mingetty tty5
    6:2345:respawn:/sbin/mingetty tty6

    This will enable the machine to actually get a logon prompt!

    1. Now.. sync the OpenVZ box to the new box
    rsync –exclude=/etc/fstab –exclude=/boot –exclude=/proc –exclude=/lib/modules/ –exclude=/etc/udev –exclude=/lib/udev –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!

    1. Power down your OpenVZ Box
    2. Reboot and start your KVM box.

    This process has worked for me pretty much every time when migrating Centos 5 and Centos 6.  I am pretty certain that the same basic idea will work with other distros.

    Related Articles


    1. Getting the following error…

      bash: rsync: command not found
      rsync: connection unexpectedly closed (0 bytes received so far) [sender]
      rsync error: remote command not found (code 127) at io.c(600) [sender=3.0.6]

      rsync appeares to be in the path… as when I’m logged into the remote machine it works from any directory… Is there Something I’m missing here ?

    Leave a Reply

    Your email address will not be published. Required fields are marked *


    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Back to top button