Article ID: 126002, created on Jun 21, 2015, last review on Jun 17, 2016

  • Applies to:
  • Virtuozzo 6.0


How to clone a container via command line


 vzmlocal  -C [--online] {CT List}
  • --online option will instruct vzmlocal to copy the main content of a running Container to a clone before suspending the source container and starting the clone.

  • without --online stopped clone will be created

  • without -C option CTID will be changed


# vzmlocal -C 200:201
          Clone CT 200.  New CT will be numbered 201.  Disposition of its private and root areas will be autogenerated.

# vzmlocal -C 200:202::/mnt/root202
          Clone CT 200.  New CT will be numbered 202 and its root area will reside under /mnt/root202


vzmlocal uses rsync for data moving, which is slower than cp.

  • cp only uses read() and write() system calls in a tight loop, while rsync uses two processes that talk to each other using reads and writes through a socket, sprinkled with loads of select() system calls. rsync always verifies that each transferred file was correctly reconstructed on the receiving side by checking a whole-file checksum that is generated as the file is transferred. Thus, rsync copy is considered to be more convenient way for most cases.

If offline cloning of a large container must be done with minimum downtime, the following copy steps can be performed:

  1. Stop source container: vzctl stop {source_ct_id}
  2. cp -a /vz/private/{source_ct_id} /vz/private/{target_ct_id}
  3. vzctl register /vz/private/{target_ct_id} {target_ct_id}
  4. change EID, and IP address
  5. vzctl start {target_ct_id}

Search Words

clone container

rsync slow

c62e8726973f80975db0531f1ed5c6a2 2897d76d56d2010f4e3a28f864d69223 0dd5b9380c7d4884d77587f3eb0fa8ef

Email subscription for changes to this article
Save as PDF