<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mogorva</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mogorva"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Mogorva"/>
	<updated>2026-05-15T15:02:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Migration_from_one_HN_to_another&amp;diff=5851</id>
		<title>Migration from one HN to another</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Migration_from_one_HN_to_another&amp;diff=5851"/>
		<updated>2008-04-29T21:48:51Z</updated>

		<summary type="html">&lt;p&gt;Mogorva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The vzmigrate script is used to migrate a Virutal Environment from one Hardware Node to another.&lt;br /&gt;
&lt;br /&gt;
You first have to setup SSH to permit the old HN to be able to login to the new HN without a password prompt. Run the following on the old HN.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@OpenVZ ~]# ssh-keygen -t rsa&lt;br /&gt;
Generating public/private rsa key pair.&lt;br /&gt;
Enter file in which to save the key (/root/.ssh/id_rsa):&lt;br /&gt;
Created directory '/root/.ssh'.&lt;br /&gt;
Enter passphrase (empty for no passphrase):&lt;br /&gt;
Enter same passphrase again:&lt;br /&gt;
Your identification has been saved in /root/.ssh/id_rsa.&lt;br /&gt;
Your public key has been saved in /root/.ssh/id_rsa.pub.&lt;br /&gt;
The key fingerprint is:&lt;br /&gt;
74:7a:3e:7f:27:2f:42:bb:52:4c:ad:55:31:6f:79:f2 root@OpenVZ.ics.local&lt;br /&gt;
[root@OpenVZ ~]# cd .ssh/&lt;br /&gt;
[root@OpenVZ .ssh]# ls -al&lt;br /&gt;
total 20&lt;br /&gt;
drwx------  2 root root 4096 Aug 11 09:41 .&lt;br /&gt;
drwxr-x---  5 root root 4096 Aug 11 09:40 ..&lt;br /&gt;
-rw-------  1 root root  887 Aug 11 09:41 id_rsa&lt;br /&gt;
-rw-r--r--  1 root root  231 Aug 11 09:41 id_rsa.pub&lt;br /&gt;
[root@OpenVZ .ssh]# scp id_rsa.pub root@10.1.5.6:./id_rsa.pub&lt;br /&gt;
The authenticity of host '10.1.5.6 (10.1.5.6)' can't be established.&lt;br /&gt;
RSA key fingerprint is 3f:2a:26:15:e4:37:e2:06:b8:4d:20:ee:3a:dc:c1:69.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
Warning: Permanently added '10.1.5.6' (RSA) to the list of known hosts.&lt;br /&gt;
root@10.1.5.6's password:&lt;br /&gt;
id_rsa.pub               100%  231     0.2KB/s   00:00&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following on the new HN.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@Char ~]# cd .ssh/&lt;br /&gt;
[root@Char .ssh]# touch authorized_keys2&lt;br /&gt;
[root@Char .ssh]# chmod 600 authorized_keys2&lt;br /&gt;
[root@Char .ssh]# cat ../id_rsa.pub &amp;gt;&amp;gt; authorized_keys2&lt;br /&gt;
[root@Char .ssh]# rm ../id_rsa.pub&lt;br /&gt;
rm: remove regular file `../id_rsa.pub'? y&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following on the old HN.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@OpenVZ .ssh]# ssh -2 -v root@10.1.5.6&lt;br /&gt;
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003&lt;br /&gt;
debug1: Reading configuration data /etc/ssh/ssh_config&lt;br /&gt;
debug1: Applying options for *&lt;br /&gt;
debug1: Connecting to 10.1.5.6 [10.1.5.6] port 22.&lt;br /&gt;
debug1: Connection established.&lt;br /&gt;
debug1: permanently_set_uid: 0/0&lt;br /&gt;
debug1: identity file /root/.ssh/id_rsa type 1&lt;br /&gt;
debug1: identity file /root/.ssh/id_dsa type -1&lt;br /&gt;
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3&lt;br /&gt;
debug1: match: OpenSSH_4.3 pat OpenSSH*&lt;br /&gt;
debug1: Enabling compatibility mode for protocol 2.0&lt;br /&gt;
debug1: Local version string SSH-2.0-OpenSSH_3.9p1&lt;br /&gt;
debug1: SSH2_MSG_KEXINIT sent&lt;br /&gt;
debug1: SSH2_MSG_KEXINIT received&lt;br /&gt;
debug1: kex: server-&amp;gt;client aes128-cbc hmac-md5 none&lt;br /&gt;
debug1: kex: client-&amp;gt;server aes128-cbc hmac-md5 none&lt;br /&gt;
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&amp;lt;1024&amp;lt;8192) sent&lt;br /&gt;
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP&lt;br /&gt;
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent&lt;br /&gt;
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY&lt;br /&gt;
debug1: Host '10.1.5.6' is known and matches the RSA host key.&lt;br /&gt;
debug1: Found key in /root/.ssh/known_hosts:1&lt;br /&gt;
debug1: ssh_rsa_verify: signature correct&lt;br /&gt;
debug1: SSH2_MSG_NEWKEYS sent&lt;br /&gt;
debug1: expecting SSH2_MSG_NEWKEYS&lt;br /&gt;
debug1: SSH2_MSG_NEWKEYS received&lt;br /&gt;
debug1: SSH2_MSG_SERVICE_REQUEST sent&lt;br /&gt;
debug1: SSH2_MSG_SERVICE_ACCEPT received&lt;br /&gt;
debug1: Authentications that can continue: publickey,gssapi-with-mic,password&lt;br /&gt;
debug1: Next authentication method: gssapi-with-mic&lt;br /&gt;
debug1: An invalid name was supplied&lt;br /&gt;
Cannot determine realm for numeric host address&lt;br /&gt;
&lt;br /&gt;
debug1: An invalid name was supplied&lt;br /&gt;
Cannot determine realm for numeric host address&lt;br /&gt;
&lt;br /&gt;
debug1: Next authentication method: publickey&lt;br /&gt;
debug1: Offering public key: /root/.ssh/id_rsa&lt;br /&gt;
debug1: Authentications that can continue: publickey,gssapi-with-mic,password&lt;br /&gt;
debug1: Offering public key: /root/.ssh/id_rsa&lt;br /&gt;
debug1: Server accepts key: pkalg ssh-rsa blen 149&lt;br /&gt;
debug1: read PEM private key done: type RSA&lt;br /&gt;
debug1: Authentication succeeded (publickey).&lt;br /&gt;
debug1: channel 0: new [client-session]&lt;br /&gt;
debug1: Entering interactive session.&lt;br /&gt;
Last login: Thu Aug  9 16:41:30 2007 from 10.1.5.20&lt;br /&gt;
[root@Char ~]# exit&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- you have at least one good backup of the virtual machine you intend to migrate&lt;br /&gt;
- rsync is installed on the target host&lt;br /&gt;
- remove_area=1 is changed to remove_area=0 in vzmigrate script&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that the vzmigrate script will function, a little bit on vzmigrate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;This program is used for container migration to another node&lt;br /&gt;
Usage:&lt;br /&gt;
vzmigrate [-r yes|no] [--ssh=&amp;lt;options&amp;gt;] [--keep-dst] [--online] [-v]&lt;br /&gt;
        destination_address &amp;lt;CTID&amp;gt;&lt;br /&gt;
Options:&lt;br /&gt;
-r, --remove-area yes|no&lt;br /&gt;
        Whether to remove container on source HN for successfully migrated container.&lt;br /&gt;
--ssh=&amp;lt;ssh options&amp;gt;&lt;br /&gt;
        Additional options that will be passed to ssh while establishing&lt;br /&gt;
        connection to destination HN. Please be careful with options&lt;br /&gt;
        passed, DO NOT pass destination hostname.&lt;br /&gt;
--keep-dst&lt;br /&gt;
        Do not clean synced destination container private area in case of some&lt;br /&gt;
        error. It makes sense to use this option on big container migration to&lt;br /&gt;
        avoid syncing container private area again in case some error&lt;br /&gt;
        (on container stop for example) occurs during first migration attempt.&lt;br /&gt;
--online&lt;br /&gt;
        Perform online (zero-downtime) migration: during the migration the&lt;br /&gt;
        container hangs for a while and after the migration it continues working&lt;br /&gt;
        as though nothing has happened.&lt;br /&gt;
-v&lt;br /&gt;
        Verbose mode. Causes vzmigrate to print debugging messages about&lt;br /&gt;
        its progress (including some time statistics).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an example of migrating container 101 from the current HN to one at 10.1.5.6:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@OpenVZ .ssh]# vzmigrate 10.1.5.6 101&lt;br /&gt;
OPT:10.1.5.6&lt;br /&gt;
Starting migration of container 101 on 10.1.5.6&lt;br /&gt;
Preparing remote node&lt;br /&gt;
Initializing remote quota&lt;br /&gt;
Syncing private&lt;br /&gt;
Syncing 2nd level quota&lt;br /&gt;
Turning quota off&lt;br /&gt;
Cleanup&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here's a simple shell script that will migrate each container one after another. Just pass the destination host node as the single argument to the script. Feel free to add the -v flag to the vzmigrate flags if you'd like to see it execute with the verbose option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#!/bin/bash&lt;br /&gt;
vzlist | tail -n +2 | awk 'BEGIN { } /.*/ { print $1 }' | xargs -n1 vzmigrate --remove-area no --keep-dst $1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Mogorva</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Migration_from_one_HN_to_another&amp;diff=5850</id>
		<title>Migration from one HN to another</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Migration_from_one_HN_to_another&amp;diff=5850"/>
		<updated>2008-04-29T21:41:57Z</updated>

		<summary type="html">&lt;p&gt;Mogorva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The vzmigrate script is used to migrate a Virutal Environment from one Hardware Node to another.&lt;br /&gt;
&lt;br /&gt;
You first have to setup SSH to permit the old HN to be able to login to the new HN without a password prompt. Run the following on the old HN.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@OpenVZ ~]# ssh-keygen -t rsa&lt;br /&gt;
Generating public/private rsa key pair.&lt;br /&gt;
Enter file in which to save the key (/root/.ssh/id_rsa):&lt;br /&gt;
Created directory '/root/.ssh'.&lt;br /&gt;
Enter passphrase (empty for no passphrase):&lt;br /&gt;
Enter same passphrase again:&lt;br /&gt;
Your identification has been saved in /root/.ssh/id_rsa.&lt;br /&gt;
Your public key has been saved in /root/.ssh/id_rsa.pub.&lt;br /&gt;
The key fingerprint is:&lt;br /&gt;
74:7a:3e:7f:27:2f:42:bb:52:4c:ad:55:31:6f:79:f2 root@OpenVZ.ics.local&lt;br /&gt;
[root@OpenVZ ~]# cd .ssh/&lt;br /&gt;
[root@OpenVZ .ssh]# ls -al&lt;br /&gt;
total 20&lt;br /&gt;
drwx------  2 root root 4096 Aug 11 09:41 .&lt;br /&gt;
drwxr-x---  5 root root 4096 Aug 11 09:40 ..&lt;br /&gt;
-rw-------  1 root root  887 Aug 11 09:41 id_rsa&lt;br /&gt;
-rw-r--r--  1 root root  231 Aug 11 09:41 id_rsa.pub&lt;br /&gt;
[root@OpenVZ .ssh]# scp id_rsa.pub root@10.1.5.6:./id_rsa.pub&lt;br /&gt;
The authenticity of host '10.1.5.6 (10.1.5.6)' can't be established.&lt;br /&gt;
RSA key fingerprint is 3f:2a:26:15:e4:37:e2:06:b8:4d:20:ee:3a:dc:c1:69.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
Warning: Permanently added '10.1.5.6' (RSA) to the list of known hosts.&lt;br /&gt;
root@10.1.5.6's password:&lt;br /&gt;
id_rsa.pub               100%  231     0.2KB/s   00:00&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following on the new HN.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@Char ~]# cd .ssh/&lt;br /&gt;
[root@Char .ssh]# touch authorized_keys2&lt;br /&gt;
[root@Char .ssh]# chmod 600 authorized_keys2&lt;br /&gt;
[root@Char .ssh]# cat ../id_rsa.pub &amp;gt;&amp;gt; authorized_keys2&lt;br /&gt;
[root@Char .ssh]# rm ../id_rsa.pub&lt;br /&gt;
rm: remove regular file `../id_rsa.pub'? y&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the following on the old HN.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@OpenVZ .ssh]# ssh -2 -v root@10.1.5.6&lt;br /&gt;
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003&lt;br /&gt;
debug1: Reading configuration data /etc/ssh/ssh_config&lt;br /&gt;
debug1: Applying options for *&lt;br /&gt;
debug1: Connecting to 10.1.5.6 [10.1.5.6] port 22.&lt;br /&gt;
debug1: Connection established.&lt;br /&gt;
debug1: permanently_set_uid: 0/0&lt;br /&gt;
debug1: identity file /root/.ssh/id_rsa type 1&lt;br /&gt;
debug1: identity file /root/.ssh/id_dsa type -1&lt;br /&gt;
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3&lt;br /&gt;
debug1: match: OpenSSH_4.3 pat OpenSSH*&lt;br /&gt;
debug1: Enabling compatibility mode for protocol 2.0&lt;br /&gt;
debug1: Local version string SSH-2.0-OpenSSH_3.9p1&lt;br /&gt;
debug1: SSH2_MSG_KEXINIT sent&lt;br /&gt;
debug1: SSH2_MSG_KEXINIT received&lt;br /&gt;
debug1: kex: server-&amp;gt;client aes128-cbc hmac-md5 none&lt;br /&gt;
debug1: kex: client-&amp;gt;server aes128-cbc hmac-md5 none&lt;br /&gt;
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&amp;lt;1024&amp;lt;8192) sent&lt;br /&gt;
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP&lt;br /&gt;
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent&lt;br /&gt;
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY&lt;br /&gt;
debug1: Host '10.1.5.6' is known and matches the RSA host key.&lt;br /&gt;
debug1: Found key in /root/.ssh/known_hosts:1&lt;br /&gt;
debug1: ssh_rsa_verify: signature correct&lt;br /&gt;
debug1: SSH2_MSG_NEWKEYS sent&lt;br /&gt;
debug1: expecting SSH2_MSG_NEWKEYS&lt;br /&gt;
debug1: SSH2_MSG_NEWKEYS received&lt;br /&gt;
debug1: SSH2_MSG_SERVICE_REQUEST sent&lt;br /&gt;
debug1: SSH2_MSG_SERVICE_ACCEPT received&lt;br /&gt;
debug1: Authentications that can continue: publickey,gssapi-with-mic,password&lt;br /&gt;
debug1: Next authentication method: gssapi-with-mic&lt;br /&gt;
debug1: An invalid name was supplied&lt;br /&gt;
Cannot determine realm for numeric host address&lt;br /&gt;
&lt;br /&gt;
debug1: An invalid name was supplied&lt;br /&gt;
Cannot determine realm for numeric host address&lt;br /&gt;
&lt;br /&gt;
debug1: Next authentication method: publickey&lt;br /&gt;
debug1: Offering public key: /root/.ssh/id_rsa&lt;br /&gt;
debug1: Authentications that can continue: publickey,gssapi-with-mic,password&lt;br /&gt;
debug1: Offering public key: /root/.ssh/id_rsa&lt;br /&gt;
debug1: Server accepts key: pkalg ssh-rsa blen 149&lt;br /&gt;
debug1: read PEM private key done: type RSA&lt;br /&gt;
debug1: Authentication succeeded (publickey).&lt;br /&gt;
debug1: channel 0: new [client-session]&lt;br /&gt;
debug1: Entering interactive session.&lt;br /&gt;
Last login: Thu Aug  9 16:41:30 2007 from 10.1.5.20&lt;br /&gt;
[root@Char ~]# exit&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- you have at least one good backup of the virtual machine you intend to migrate&lt;br /&gt;
- rsync is installed on the target host&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that the vzmigrate script will function, a little bit on vzmigrate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;This program is used for container migration to another node&lt;br /&gt;
Usage:&lt;br /&gt;
vzmigrate [-r yes|no] [--ssh=&amp;lt;options&amp;gt;] [--keep-dst] [--online] [-v]&lt;br /&gt;
        destination_address &amp;lt;CTID&amp;gt;&lt;br /&gt;
Options:&lt;br /&gt;
-r, --remove-area yes|no&lt;br /&gt;
        Whether to remove container on source HN for successfully migrated container.&lt;br /&gt;
--ssh=&amp;lt;ssh options&amp;gt;&lt;br /&gt;
        Additional options that will be passed to ssh while establishing&lt;br /&gt;
        connection to destination HN. Please be careful with options&lt;br /&gt;
        passed, DO NOT pass destination hostname.&lt;br /&gt;
--keep-dst&lt;br /&gt;
        Do not clean synced destination container private area in case of some&lt;br /&gt;
        error. It makes sense to use this option on big container migration to&lt;br /&gt;
        avoid syncing container private area again in case some error&lt;br /&gt;
        (on container stop for example) occurs during first migration attempt.&lt;br /&gt;
--online&lt;br /&gt;
        Perform online (zero-downtime) migration: during the migration the&lt;br /&gt;
        container hangs for a while and after the migration it continues working&lt;br /&gt;
        as though nothing has happened.&lt;br /&gt;
-v&lt;br /&gt;
        Verbose mode. Causes vzmigrate to print debugging messages about&lt;br /&gt;
        its progress (including some time statistics).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an example of migrating container 101 from the current HN to one at 10.1.5.6:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@OpenVZ .ssh]# vzmigrate 10.1.5.6 101&lt;br /&gt;
OPT:10.1.5.6&lt;br /&gt;
Starting migration of container 101 on 10.1.5.6&lt;br /&gt;
Preparing remote node&lt;br /&gt;
Initializing remote quota&lt;br /&gt;
Syncing private&lt;br /&gt;
Syncing 2nd level quota&lt;br /&gt;
Turning quota off&lt;br /&gt;
Cleanup&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here's a simple shell script that will migrate each container one after another. Just pass the destination host node as the single argument to the script. Feel free to add the -v flag to the vzmigrate flags if you'd like to see it execute with the verbose option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#!/bin/bash&lt;br /&gt;
vzlist | tail -n +2 | awk 'BEGIN { } /.*/ { print $1 }' | xargs -n1 vzmigrate --remove-area no --keep-dst $1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Mogorva</name></author>
		
	</entry>
</feed>