7.1. Migrating Containers from Legacy Products to Virtuozzo Hybrid Server 7¶
You can migrate containers from a server running Virtuozzo Containers for Linux 4.7 or OpenVZ based on kernels 2.6.18 and 2.6.32 to a Virtuozzo Hybrid Server 7 server. Use the ovztransfer.sh script freely available at https://src.openvz.org/scm/ovzl/ovztransfer.git.
Note
Before the migration, take into account the following:
Ensure the source node can connect to the destination node via SSH.
The recommended and highest-supported destination hardware node version is Virtuozzo Hybrid Server 7.5 Update 4.
Do the following:
Install an SSH key on the destination server for the root user. To do this, generate a key on the source server:
# ssh-keygen -t rsa
Then transfer the key to the destination server:
# ssh-copy-id root@<dest_server>
Clone the script repository to the source OpenVZ server:
# git clone https://src.openvz.org/scm/ovzl/ovztransfer.git
Change to the
/ovztransferdirectory and make the script executable:# chmod 755 ovztransfer.sh
Stop the containers to be migrated.
Initiate migration on the source OpenVZ server as follows:
# ./ovztransfer.sh <dest_server> <source_CT1_ID>[:<new_CT1_name>] \ [ ... <source_CTn_ID>[:<new_CTn_name>]]
Where
<source_CT_ID>(the source container ID) and<new_CT_name>(the new container name) must both be specified in the old numerical ID format. For example:# ./ovztransfer.sh 192.168.0.10 100:200
So, in the example above,
200will be the name of the resulting ploop-based container on the Virtuozzo Hybrid Server 7 server, even though said name looks like an old numerical ID.
You can tweak script behavior with the following environment variables:
OVZTR_METHOD, can betar+ssh(default) orrsync. Sets the method of transferring the data to the destination node. With the defaulttar+ssh, the container data is packed using tar, passed via pipe and SSH to the destination node, and unpacked. Withrsync, the container data is copied to the destination using rsync over SSH.OVZTR_COMPRESS, can be0(disabled) or1(enabled). Toggles compression during data transfer. If enabled, adds the-zoption to tar or rsync. Enabling compression saves network traffic but results in higher CPU load.
For example:
# export OVZTR_COMPRESS=1 OVZTR_METHOD=rsync
# ./ovztransfer.sh 192.168.0.10 100:200