qm destroy Command Examples in Linux

The qm destroy command is a command-line tool provided by the QEMU/KVM Virtual Machine Manager that allows users to destroy or delete a virtual machine. When a virtual machine is destroyed, all of its data and configuration settings are deleted from the system, and the resources that were allocated to the virtual machine are released and made available for other uses.

To use qm destroy, users need to specify the ID number of the virtual machine they want to delete. The command will then prompt the user to confirm the deletion, to ensure that they do not accidentally delete a virtual machine that they still need.

qm destroy Command Examples

1. Destroy a specific virtual machine:

# qm destroy {{vm_id}}

2. Destroy all disks that are not explicitly referenced in a specific virtual machine’s configuration:

# qm destroy {{vm_id}} --destroy-unreferenced-disks

3. Destroy a virtual machine and remove from all locations (inventory, backup jobs,high availability managers, etc.):

# qm destroy {{vm_id}} --purge

4. Destroy a specific virtual machine ignoring locks and forcing destroy:

# sudo qm destroy {{vm_id}} --skiplock

Summary

It is important to note that once a virtual machine is destroyed, all of its data is permanently deleted and cannot be recovered. Users should therefore exercise caution when using the qm destroy command, and make sure that they have a backup of any important data or settings before proceeding.

In addition to the qm destroy command, the QEMU/KVM Virtual Machine Manager provides a variety of other commands and features for managing virtual machines, including creating, cloning, modifying, and backing up VMs. More information about qm destroy 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.

Related Post