LinuxCommandLibrary

qm-clone

Clone virtual machines and containers

TLDR

Copy a virtual machine

$ qm copy [vm_id] [new_vm_id]
copy

Copy a virtual machine using a specific name
$ qm copy [vm_id] [new_vm_id] --name [name]
copy

Copy a virtual machine using a specific descriptionn
$ qm copy [vm_id] [new_vm_id] --description [description]
copy

Copy a virtual machine creating a full copy of all disks
$ qm copy [vm_id] [new_vm_id] --full
copy

Copy a virtual machine using a specific format for file storage (requires --full)
$ qm copy [vm_id] [new_vm_id] --full --format [qcow2|raw|vmdk]
copy

Copy a virtual machine then add it to a specific pool
$ qm copy [vm_id] [new_vm_id] --pool [pool_name]
copy

SYNOPSIS

qm clone [OPTIONS]

PARAMETERS


    The ID of the source VM or container to clone.


    The new ID to assign to the cloned VM or container.

--name
    Set the name for the new VM or container.

--target
    Target node. Only required if source VM is HA and/or on shared storage.

--storage
    Target storage for full clone. Can only be specified if --full is given.

--full
    Create a full clone (default is linked clone).

--snapname
    Snapshot to clone.

--description
    Description for the new VM or Container

--pool
    Add the new VM to the specified pool.

--unique
    Generate a new unique MAC address for all network devices.

--format
    Target format (only valid for full clones).

--bwlimit
    Limit I/O bandwidth (in KiB/s).

DESCRIPTION

The qm clone command is used within the Proxmox Virtual Environment (PVE) to create a copy, or clone, of an existing Virtual Machine (VM) or Container. This allows for rapid deployment of similar VMs, testing environments, or backups. It creates a full or linked clone from an existing VM. A full clone copies all disks, while a linked clone creates a new VM that shares a read-only base image with the original VM. Modifications to the linked clone are stored in separate delta files. The --full parameter dictates whether a full or linked clone is created. The cloned VM will get new unique VMID and a different set of configurations which can be tweaked during the clone creation process using various command line parameters. This avoids potential configuration conflicts and ensures the new VM functions independently. The command is crucial for efficient VM management and deployment within a PVE cluster.

CAVEATS

Linked clones depend on the base image. Deleting or modifying the base image of a linked clone can corrupt its data. Moving a linked clone is more complex than moving a full clone.

SNAPSHOT CONSIDERATIONS

If the original VM had snapshots, the --snapname parameter allows cloning from a specific snapshot. If not specified, the clone will be created from the current state of the VM.

SEE ALSO

qm create(1), qm destroy(1), qm move(1)

Copied to clipboard