2.5. Cloning Virtual Machines and Containers¶
You can create a copy (clone) of a particular virtual machine or container that will have identical data and resource parameters. Cloning may save time as clones require little reconfiguration compared to setting up new virtual machines or containers.
You can clone stopped virtual machines and stopped and running containers. For example:
# prlctl clone MyCT --name MyCT_clone
# prlctl clone MyVM --name MyVM_clone
The --name option specifies a name for the clone.
When cloning Windows virtual machines, consider changing their security identifiers (SIDs) with the --changesid option.
Successfully cloned virtual machines and containers will be shown in the list of virtual environments on the host. For example:
# prlctl list -a
UUID STATUS IP_ADDR T NAME
{62951c2a-...} stopped 10.30.10.101 CT MyCT
{49b66605-...} stopped 10.30.10.101 CT MyCT_clone
{7f4904ad-...} stopped 10.30.128.115 VM MyVM
{2afb2aa2-...} stopped 10.30.128.134 VM MyVM_clone
The example above shows that the cloned container has the same IP address as the original container. Before starting to use the clones, make sure their IP addresses are unique (for instructions on how to assign IP addresses to VMs and containers, see Configuring Network Settings).
2.5.1. Configuring Default Directories¶
When cloning a virtual machine or container, you can also override the following default directories:
default directory
/vz/vmprivate/<dest_UUID>storing the files of a cloned virtual machine (where<dest_UUID>denotes the UUID of the resulting virtual machine). To store the files of theMyVM_clonevirtual machine in a custom directory, you can run the following command:# prlctl clone MyVM --name MyVM_clone --dst vz/vmprivate/customVMs
In this case all virtual machine files will be placed to the
/customVMsdirectory. Note that the specified directory must exist on the server; otherwise, the command will fail.default directory
/vz/private/<dest_UUID>defining the container private area (where<dest_UUID>denotes the UUID of the resulting container). To define a custom private area path for the containerMyCT_clone, you can execute the following command:# prlctl clone MyCT1 --name MyCT_clone --dst /vz/private/customCTs
Note
The default /vz/vmprivate and /vz/private are valid for servers that do not participate in Virtuozzo storage clusters.