How to Convert/Migrate OpenVZ VPS to Xen/KVM  Print this Article

When moving a KVM image to another server, it's a pretty simple process. If you're using SolusVM or Virtualizor, it makes it even easier. However, if you have a VM node which hosts openVZ containers and need to move them to a new node with different virtualization, QEMU/KVM in this case, it makes things a little more difficult.

The main different between KVM and openVZ is the level of virtualization. OpenVZ is an OS level virtualization which means the hosts' kernel is shared with guest containers inside it, you can’t use your own kernel. KVM is very different. It’s a full virtualization. The whole OS and its kernel is virtualized so you can even install an OS with its own kernel in it, like installing Windows VM inside a linux host. So let's get on with this tutorial now that we have a littl background.

- Converting OpenVZ to KVM box

Let’s start the moving process.

1. The first step before start moving the box is installing a KVM box with the exact same OS as the openVZ container, preferably same point revision too (You will want to run yum update on both VM's to make sure)

2. SSH into both VMs.

3. In the KVM box, or openVZ box, install mingetty. I’m using CentOS 6.2 so I use yum to install mingetty

yum install mingetty

4. Edit /etc/inittab in the VM installed with mingetty

vi /etc/inittab

and add these lines

# Run gettys in standard run levels
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.

5. Install rsync on both VMs

yum install rsync

6. From the openVZ box, make a text file containing files to exclude. This will preserve settings in KVM box to make sure the VM is bootable.

nano /root/exclude.txt

add these lines to exclude.txt, you may customize it to your needs


7. Now we can start to sync the OpenVZ box to the KVM box. In the openVZ box, type:

rsync --exclude-from="/root/exclude.txt" --delete --numeric-ids -avpogtStlHz -e "ssh -p <ssh port>" / root@<target ip>:/

That’s all, to make sure everything’s working, reboot the KVM box when the rsync process has completed. Once your new KVM box is up, you will have to go in there and make the IP changes to cPAnel/WHM, shoutcast, zPanel, or whichever other control panel you're using. 

Was this answer helpful?

Also Read

Installing Softaculous on your VPS or Dedicated Server
Before starting the installation make sure ionCube Loaders are enabled. For that go to WHM and...
Converting an Addon Domain to a Stand alone cPanel
Addon domain turned into a separate cPanel Download the content of your addon domain to your...
How to Install FFMPEG on CentOS (6.3, 6.4)
Ok, so you just got a VPS or Dedicated Server and want to set it up with FFMPEG...
How to install Lubuntu Desktop on your Ubuntu VPS
You have just ordered a VPS from with the Ubuntu OS. However, by default the...
How to Install MP4Box
To install MP4Box, you would do the following:cd /usr/local/src/wget...

Powered by WHMCompleteSolution