寻觅生命中的那一片浅草......

每日存档 五月 31st, 2010

How to clone an OpenVZ virtual machine

I need sometimes to clone a vps in an openvz environment, so here you can find three methods to do this task:

first option:

# vzctl stop 101
Stopping VE ...
VE was stopped
VE is unmounted
# cp -r /vz/private/101 /vz/private/202
# cp /etc/vz/conf/101.conf /etc/vz/conf/202.conf
# vzctl start 202
Starting VE ...
Initializing quota ...
VE is mounted
Setting CPU units: 1000
VE start in progress...

the second option:

#mkdir /vz/private/new_VEid
#cd /vz/private/old_VEID
#tar cf - * | ( cd /vz/private/new_VEid tar xfp -)
#cp old_VEID.conf new_VEID.conf

and the third option:

# OLDVE=222 NEWVE=333 # Just an example
# vzctl stop $OLDVE
# mkdir /vz/root/$NEWVE
# cp /etc/vz/conf/$OLDVE.conf /etc/vz/conf/$NEWVE.conf
# cp -a /vz/private/$OLDVE /vz/private/$NEWVE
# vzctl start $NEWVE; vzctl start $OLDVE

from:http://www.vioan.ro/wp/2007/07/30/how-to-clone-an-openvz-virtual-machine/
2010年五月
« 4月   6月 »
 12
3456789
10111213141516
17181920212223
24252627282930
31