Migrate openvz container to proxmox VE best practice
By Ruben on Feb 22, 2011 | In OpenVZ, Proxmox VE (Virtual Environment) | Send feedback »
UPDATE:
Alternative method to do this:
@SOURCE NODE (=openvz node)
# ssh-copy-id -i ~/.ssh/id_rsa.pub targethost.domain.tld
# mkdir -p /var/lib/vz
# ln -s /vz/private /var/lib/vz
# ln -s /vz/root /var/lib/vz
# nano -w /etc/vz/conf/101.conf
#VE_ROOT="/vz/root/$VEID"
#VE_PRIVATE="/vz/private/$VEID"
VE_ROOT="/var/lib/vz/root/$VEID"
VE_PRIVATE="/var/lib/vz/private/$VEID"
ORIGIN_SAMPLE="pve.auto"
# vzmigrate targethost.domain.tld 101
On error: "Error: Failed to stop container", migrate again! (Only this time the container is offline)# vzmigrate targethost.domain.tld 101
@DESTINATION NODE (=proxmox ve)
# vzctl restart 101
-------------------------------------------------------------------------------------
ORIGINAL ARTICLE/METHOD
-------------------------------------------------------------------------------------
In this article I describe the process of moving an openvz container from a openvz server to a proxmox VE host.
The challenge:
- we want to have a minimum of downtime
- we want
/etc/vz/private/101
and/etc/vz/root/101
moved to "Proxmox directories"/var/lib/private/101
and/var/lib/root/101
Requirements:
- a running openvz host
- a running proxmox host
The plan:
- reconfigure "root" and "private" dirs of the container to fit proxmox
- alter container's configuration file and stop container
- do a second sync of earlier mentioned directories
- restart the container
- migrate the container to the proxmox host (over a SSH connection)
- fix the container's configuration at the proxmox host
Example to migrate container 101 to proxmox VE at another host node (targethost.domain.tld). Run these commands as root user.
@SOURCE NODE (=openvz node)# mkdir -p /var/lib/vz/private
# mkdir -p /var/lib/vz/root# rsync --progress -a --delete \
--include="/*/dev/console" \
--include="/*/dev/initctl" \
--include="/*/dev/null" \
--include="/*/dev/zero" \
--exclude="/*/dev/*" \
--exclude="/*/proc/*" \
--exclude="/*/sys/*" \
--exclude="/*/tmp/*" \
--exclude="*lost+found" \
/vz/private/101 /var/lib/vz/private/
# vzctl stop 101
# nano -w /etc/vz/conf/101.conf
#VE_ROOT="/vz/root/$VEID"
#VE_PRIVATE="/vz/private/$VEID"
VE_ROOT="/var/lib/vz/root/$VEID"
VE_PRIVATE="/var/lib/vz/private/$VEID"
# vzctl start 101
# vzquota drop 101
# ssh-copy-id -i ~/.ssh/id_rsa.pub targethost.domain.tld
# vzmigrate targethost.domain.tld 101
@DESTINATION NODE (=proxmox ve)
# nano -w /etc/vz/conf/101.conf
ORIGIN_SAMPLE="pve.auto"
# vzctl restart 101
https://wiki.archlinux.org/index.php/Full_System_Backup_with_rsync
http://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE#Move_OpenVZ_containers_to_Proxmox_VE
No feedback yet
Comments are closed for this post.
« Migrating a shared server client database to a Direct Admin server (shell commands) | Things I miss in Proxmox Virtual Environment 1.7 Webgui » |