Copying a Parallels Virtuozzo container to a new hypervisor

In this note I want to cover how to copy/migrate a Parallels Virtuozzo container to KVM/VMware ESX/VirtualBox.

The main problem with this is that Virtuozzo containers have no concept of a full-fledged OS. A container is basically a chroot you see as a folder on disk. I’ll cover moving a Linux container.

There are two approaches:

  1. Just copy all the files from the container into a ready-made VM.
  2. Build an image using Parallels Bare Metal Server (PBMS) as an intermediate step

Each has its pros and cons. With the first method the OS versions need to match 100%. There’s a risk of the new VM running into problems.

To copy the VM directly:

  1. Connect to the Virtuozzo server and check whether the machine is running:
vzlist -a

You get back a list of containers and their statuses:
Screenshot from 2014-08-11 08:58:31

If the container you need is stopped, mount it (no need to start it):

vzctl mount 69540

Then connect to the new virtual server and copy over all the data from the container:

rsync -arzv root@**%Parallels_Server_IP%**%:/vz/root/69540/ -exclude /boot -exclude /proc -exclude /sys -exclude /dev/pts -exclude /dev/shm -exclude /dev -exclude /lib/firmware -exclude /lib/modules -exclude /lib/udev -exclude /lib/udev/rules.d /mnt

Delete a couple files and restart the VM:

rm -rf /mnt/etc/sysconfig/network-scripts/* && rm -rf /mnt/var/cache/yum/*

This tutorial falls into the How not to do it category. I don’t like it, because it works about 50/50. Parallels Virtuozzo is a commercial product and this cowboy approach isn’t recommended.

For a proper conversion, better to get a temporary BareMetal license, valid for 30 days, and use the container conversion article