LinuxCommandLibrary

pct-clone

Clone existing Proxmox containers

TLDR

Clone a container

$ pct [[cl|clone]] [template_id] [copy_id]
copy

Clone a container with a custom name
$ pct [[cl|clone]] [template_id] [copy_id] --hostname [host_name]
copy

SYNOPSIS

pct clone VMID NEWID [OPTIONS]

PARAMETERS

--bwlimit <number>
    Limit I/O bandwidth (KiB/s) during clone.

--description <string>
    Description for the new container.

--fullname <string>
    Full name (ID and hostname) of new container.

--full [<boolean>]
    Create full clone (copies all data).

--hostname <name>
    Set hostname for new container.

--memory <number>
    Memory size in MiB.

--nameserver <string>
    DNS server IP.

--net0 <name>[,<type>],[<mac>],[<bridge>],etc.
    Configure first network device.

--onboot <boolean>
    Start on boot (default 1).

--ostype <string>
    OS type: c (CentOS), debian, etc.

--rootfs <volume>[,<size>]
    Rootfs disk (size, storage, etc.).

--searchdomain <string>
    DNS search domain.

--shares <number>
    CPU shares for new container.

--snapname <string>
    Snapshot name for base clone.

--storage <string>
    Target storage name.

--swap <number>
    Swap size in MiB.

--unprivileged [<boolean>]
    Create unprivileged container.

DESCRIPTION

The pct clone command creates a copy of an existing Proxmox Virtual Environment (VE) LXC container. It supports two modes: thin provisioning via snapshots (default, space-efficient) or full clones with data duplication.

Cloning is performed by specifying the source container ID (VMID) and a new unique ID (NEWID). Target storage can be selected, and various container properties like hostname, memory, network, and rootfs can be customized during cloning. This enables rapid deployment of identical environments for testing, scaling, or backups.

By default, clones share the original root filesystem via a snapshot, minimizing disk usage until changes are made (copy-on-write). Full clones (--full) copy all data independently. Bandwidth can be limited for large clones. Clones inherit most settings but allow overrides for flexibility in Proxmox clusters.

CAVEATS

Requires snapshot-capable storage (e.g., LVM-thin, ZFS). Source container must be stopped for full clones. New ID must be unique. Thin clones share storage until modified.

EXAMPLES

pct clone 100 101 --storage local-lvm
Thin clone to local-lvm.

pct clone 100 200 --full 1 --bwlimit 10240
Full clone with 10MiB/s limit.

pct clone 100 150 --hostname node2 --memory 2048
Clone with custom hostname/memory.

NOTES

Run as root or with sufficient Proxmox privileges. Check pct status VMID before cloning.

HISTORY

Introduced in Proxmox VE 2.0 (2012) as part of pct toolkit. Enhanced in VE 4.0+ with better snapshot support and options like --full. Evolved from LXC tools for enterprise container management.

SEE ALSO

pct(1), qm clone(1), lxc-copy(1)

Copied to clipboard