Difference between revisions of "Cloning VE"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
Line 3: Line 3:
 
  # OLDVE=222 NEWVE=333 # Just an example
 
  # OLDVE=222 NEWVE=333 # Just an example
 
  # vzctl stop $OLDVE
 
  # vzctl stop $OLDVE
  # mkdir /vz/root/$NEWVE
+
  # mkdir /vz/root/$NEWVE                                 # on debian, configuration is under /etc/vz/
  # cp /etc/vz/conf/$OLDVE.conf /etc/vz/conf/$NEWVE.conf
+
  # cp /etc/vz/conf/$OLDVE.conf /etc/vz/conf/$NEWVE.conf   # on debian, configuration is under /etc/vz/
 
  # mkdir /vz/private/$NEWVE
 
  # mkdir /vz/private/$NEWVE
 
  # pushd /vz/private/$OLDVE; tar c --numeric-owner * | tar x --numeric-owner -C /vz/private/$NEWVE; popd
 
  # pushd /vz/private/$OLDVE; tar c --numeric-owner * | tar x --numeric-owner -C /vz/private/$NEWVE; popd

Revision as of 09:19, 10 February 2010

If you need to create an exact copy of an existing VE, these are the steps to make.

# OLDVE=222 NEWVE=333 # Just an example
# vzctl stop $OLDVE
# mkdir /vz/root/$NEWVE                                  # on debian, configuration is under /etc/vz/
# cp /etc/vz/conf/$OLDVE.conf /etc/vz/conf/$NEWVE.conf   # on debian, configuration is under /etc/vz/
# mkdir /vz/private/$NEWVE
# pushd /vz/private/$OLDVE; tar c --numeric-owner * | tar x --numeric-owner -C /vz/private/$NEWVE; popd
# vi /etc/vz/conf/$NEWVE.conf # Change the IP_ADDRESS
# vzctl start $NEWVE; vzctl start $OLDVE

In case you are making bridge don't forget, before start the VEs, to change host_ifname=veth$OLDVE by host_ifname=veth$NEWVE in the /etc/vz/conf/$NEWVE.conf file

See also

The relevant services, particularly when the mySQLd encounters timeout errors, follow the following thread: