The qm clone command is a command-line tool provided by the QEMU/KVM Virtual Machine Manager that allows users to create a copy of a virtual machine (VM) on their system. This can be useful for a variety of purposes, such as creating backups of VMs, creating test environments, or deploying multiple copies of the same VM for different users.
To use qm clone, users first need to have an existing virtual machine that they want to clone. They can then run the qm clone command with the ID of the source VM and the desired name and ID for the new VM.
qm clone Command Examples
1. Copy a virtual machine:
# qm copy {{vm_id}} {{new_vm_id}}
2. Copy a virtual machine using a specific name:
# qm copy {{vm_id}} {{new_vm_id}} --name {{name}}
3. Copy a virtual machine using a specific descriptionn:
# qm copy {{vm_id}} {{new_vm_id}} --description {{description}}
4. Copy a virtual machine creating a full copy of all disks:
# qm copy {{vm_id}} {{new_vm_id}} --full
5. 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}}
6. Copy a virtual machine then add it to a specific pool:
# qm copy {{vm_id}} {{new_vm_id}} --pool {{pool_name}}
Summary
The qm clone command can also be used to create a full clone of a VM or a linked clone. A full clone is a complete copy of the original VM, including all disk and configuration files. A linked clone, on the other hand, is a copy of the VM that shares the same disk images as the original VM, but has its own configuration files. Linked clones can be useful for creating multiple instances of a VM without using additional disk space.
In addition to creating clones of VMs, the QEMU/KVM Virtual Machine Manager provides a variety of other commands and features for managing virtual machines, including creating and deleting VMs, modifying their configuration, and monitoring their performance.
Overall, qm clone is a powerful tool for managing virtual machines on a Linux system, allowing users to easily create copies of existing VMs for a variety of purposes. More information about qm clone and other features of the QEMU/KVM Virtual Machine Manager can be found in the project’s documentation at https://pve.proxmox.com/pve-docs/qm.1.html.