pct-clone
Clone existing Proxmox containers
TLDR
Clone a container
Clone a container with a custom name
SYNOPSIS
pct clone <vmid> <newid> [OPTIONS]
<vmid>: The ID of the source LXC container.
<newid>: The desired ID for the new cloned LXC container.
PARAMETERS
--full
Performs a full, independent copy of the container's disk, consuming more space and time but ensuring no dependency on the source.
--snapshot
Creates a linked clone from a specific snapshot of the source container, if snapshots are available.
--storage
Specifies the target storage for the new container's disk. If omitted, the source container's storage is used.
--format
Sets the disk image format (e.g., raw
, qcow2
) for the new container's disk.
--target-node
Defines the Proxmox node where the cloned container will be created. Necessary for cross-node cloning.
--description
Adds a descriptive text for the new container, visible in the Proxmox UI.
--hostname
Sets the hostname for the newly created container. If not specified, the old hostname might be kept or derived.
--size
Adjusts the disk size of the new container's root filesystem. Accepts units like 'G' for Gigabytes.
--bwlimit
Limits the bandwidth used for disk operations during cloning in KB/s. Useful for large clones over busy networks.
--ignore-lock
Proceeds with cloning even if the source container is locked. Use with caution as it may lead to inconsistent clones.
DESCRIPTION
The pct-clone command is a core utility within the Proxmox Virtual Environment (PVE) suite, designed to efficiently duplicate existing Linux Containers (LXC). This command is indispensable for administrators needing to quickly provision new containers based on a pre-configured template, or to create a snapshot-like backup for testing purposes.
It offers two primary cloning methods: linked clones and full clones. Linked clones, the default behavior when supported by the storage backend (e.g., ZFS, LVM-Thin, Ceph), are extremely fast and space-efficient as they only store the differences from the original container's disk image. However, they remain dependent on the source container's integrity. Full clones, specified with the --full
option, create a completely independent copy of the container's disk, making it self-contained and easily movable, though it consumes more disk space and takes longer to create. This flexibility makes pct-clone a powerful tool for rapid deployment and environment management in Proxmox.
CAVEATS
When using linked clones, the new container remains dependent on the original source container and its disk image. Deleting the source or specific snapshots can render the linked clone unusable. Full clones, while independent, consume significantly more disk space and take longer to create. Always ensure sufficient disk space on the target storage before initiating a clone operation. Cloning a running container without using a snapshot might result in an inconsistent state in the cloned instance.
<I>CLONE TYPES EXPLAINED</I>
Linked Clones: These are the default for snapshot-capable storage. They are extremely fast and space-efficient as they only store changes relative to the original. Ideal for quick test environments, but dependent on the source.
Full Clones: Created using the --full
option, these are completely independent copies of the container's disk. They consume more space and time but offer full autonomy and are easily migratable without source dependencies.
HISTORY
The pct-clone command is an integral part of the Proxmox Virtual Environment (PVE) project, which has been under continuous development since its inception. As PVE evolved to support Linux Containers (LXC) natively, tools like pct-clone were developed to provide robust and flexible management capabilities, becoming a cornerstone for efficient container deployment and replication within the Proxmox ecosystem.