Previous page

Next page

Locate page in Contents

Print this page

Copying Virtual Machines and Containers within Server

You can create a complete copy of a particular virtual machine or Container (in respect of all the virtual machine or Container data and resources parameters), or a clone. This saves your time because you do not have to think of setting up the virtual machine or Container configuration parameters and the like. Moreover, you can create a number of clones at a sitting.

In Virtuozzo, you can use the prlctl clone command to copy a virtual machine or Container within the given physical server. To clone a Container or a virtual machine, it must be stopped. For example, you can create a clone of Container 101 and the MyVM virtual machine by running these commands:

# prlctl clone 101 --name 111

# prlctl clone MyVM --name ClonedVM

The --name option specifies which ID or name should be assigned to the new clones.

Checking the Cloned Virtual Machine or Container

To check that your virtual machine or Container has been successfully moved, run this command:

# prlctl list -a

UUID STATUS IP_ADDR T NAME

{62951c2a-...} stopped 10.0.10.101 CT 101

{49b66605-...} stopped 10.0.10.101 CT 111

{7f4904ad-...} stopped 10.0.10.115 VM MyVM

{2afb2aa2-...} stopped 10.30.128.134 VM ClonedVM

As you can see from the example above, the clones of Container 101 (Container 111) and the MyVM virtual machine (ClonedVM) have been successfully created. However, before starting to use the clones, you should assign different IP addresses to them which are currently identical to those of Container 101 and MyVM. Refer to Performing Initial Configuration to learn how you can do it.

Configuring Default Directories

When cloning a virtual machine or Container, you can also override the following default directories:

  • /var/parallels/dest_VM_Name.pvm storing the files of a cloned virtual machine (where dest_VM_Name denotes the name of the resulting virtual machine). For example, for the ClonedVM virtual machine, this directory is /var/parallels/ClonedVM.pvm. To store the files of the ClonedVM virtual machine in a custom directory, you can run the following command:

    # prlctl clone MyVM --name ClonedVM --dst /customVMs

    In this case all virtual machine files will be placed to the /customVMs directory. Notice that the specified directory must exist on the server; otherwise, the command will fail.

  • /vz/private/<dest_CTID> defining the Container private area(where <dest_CTID> denotes the ID of the resulting Container). For Container 111, this path is /vz/private/111. To define a custom private area path for Container 111, you can execute the following command:

    # prlctl clone 101 --name 111 --dst /vz/private/customCTs

Note: The default /var/parallels and /vz/private are valid for servers that do not participate in Virtuozzo Storage clusters. If your server is part of a cluster, consult the Virtuozzo Storage Administrator's Guide for information on the default directories for storing virtual machines and Containers.