Ovz container live migration

From vpsget wiki
Revision as of 23:17, 8 July 2020 by Ndi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here we'll shortly describe how to migrate container from one node to another.

using openvz and solusvm CP.

For more details please refer to the next links:



Please note that vzctl is used for openvz6 and also with openvz7 but for openvz7 we suggest to use prlctl migrate instead as vzctl deprecated for openvz7 We are assuming that the ssh keys are already configured. In order to exclude any errors we suggest you to check the ssh connectivity between nodes [from source node to dest] like

ssh -p 6622

and vice versa [from dest node to source]

you need to find the container ID. you can find it by name or by ip. For example let's find it by ip:

vzlist -a | grep <IP>

After that we can use vzmigrate with --live option to make migration w/o container stops:

vzmigrate --live --ssh="-p <port_number>" <destination_node_ip> <container_ID>


vzmigrate --live --ssh="-p 7822" 892

You may keep original CT private area (filesystem) on the source node for backup or any other purposes (this will remove CT config file but keep files), just add -r=no key:

vzmigrate --live --remove-area no --ssh="-p 7822" 892

Note in latest vzmigrate versions use --online instead of --live:

vzmigrate --online --remove-area no --ssh="-p 7722" 2233
  • UPD* openvz7 can use prlctl migrate , like:
prlctl migrate <CTID> <destination_node_IP> --ssh "-o Port=<SSH_PORT>" --clone  #with clone option


prlctl migrate <CTID> <destination_node_IP> --ssh "-o Port=<SSH_PORT>" -v 10 # with verbose/detailed info 

Note if you are using differ ssh port please change it. if you are using standart ssh port - you can simply remove ssh section from the current command.

Use --check-only, --dry-run keys to do not perform actual migration. this will only test that container could be migrated. "Emulate migration"

 vzmigrate --live --remove-area no --check-only --ssh="-p 7822" 892

in case of problems/errors add -v flag for verbose:

vzmigrate --live --ssh="-p 6622" 892 -v

max 4 verbosity level:

vzmigrate --live --ssh="-p 6622" 892 -v -v -v -v

You may add --nodeps in case you get any dependency problems:

vzmigrate --live --ssh="-p 7822" 892 --nodeps

You will see output :

Starting live migration of CT 892 to
Preparing remote node
Initializing remote quota
Syncing private
Live migrating container...
Syncing 2nd level quota
Cleaning up

After that you will need to update your SolusVM master so it knows where the VPS has been moved to:

/scripts/vm-migrate [VSERVERID] [NEWNODEID]

RUN this command on the SolusVM master server!


/scripts/vm-migrate 885 2
 Virtual server information updated!

Please NOTE: container ID (CTID) and VSERVERID are differ (in most cases) to get VSERVERID you should simply take a look on it in SolusVM CP or in WHMCS panel or from solusvm database:

select vserverid from vservers where ctid=892;

As you can see in our example the VSERVERID and container_ID are differ.

If you receive vzquota related error, check

cat /proc/vz/vzquota

in case you CTI present in list try to :

vzquota off [CTID]
vzquota drop [CTID]

IN case this no help you need to restart VM and drop quota:

vzctl stop [CTID]
 #vzctl umount [CTID] #optional for some cases
vzquota off [CTID]
vzquota drop [CTID]
vzquota show [CTID]
vzctl start [CTID]

If you other having problems with migration. Try to make it not live, try to use -v for verbose debug and also remember to check remote node logs, not only source.