On this page

How To Do Live Migration Of OpenVZ Containers

Version 1.0
Author: Falko Timme

This guide explains how you can do a live migration of an OpenVZ container from one OpenVZ host to the other. Both OpenVZ hosts are running on Debian Lenny in this article, but the live migration does not differ on other distributions.

2 Live Migration Of vm1.example.com From server1 To server2

To check if the live migration is really done "live", i.e. without interruption of the guest, you can log into vm1.example.com (e.g. with SSH) and ping another server:

vm1.example.com:

ping google.com

This will ping google.com until you press CTRL + C. The pinging should continue even during the live migration.

server1:

I want to run the live migration as the root user. Live migration will work only if the root user on server1 can log into server2 via SSH without being asked for a password (this means SSH root logins must be allowed on server2 - check your sshd configuration: /etc/ssh/sshd_config). This can be achieved by generating a key pair for root@server1 and then store root@server1's public key in the ~/.ssh/authorized_keys file of root@server2. Fortunately, there's a bash script that can do this for us. We create the script as follows: