LinuxCommandLibrary

qm-delsnapshot

Delete a virtual machine snapshot

TLDR

Delete a snapshot

$ qm [[del|delsnapshot]] [vm_id] [snapshot_name]
copy

Delete a snapshot from a configuration file (even if removing the disk snapshot fails)
$ qm [[del|delsnapshot]] [vm_id] [snapshot_name] --force 1
copy

SYNOPSIS

qm delsnapshot <vmid> <snapname> [OPTIONS]

PARAMETERS

<vmid>
    The unique identifier (ID) of the virtual machine or container from which the snapshot will be deleted.

<snapname>
    The name of the snapshot to be deleted. This name must exactly match an existing snapshot for the specified VM/CT.

--force <boolean>
    If set to 1 (true), the command will attempt to force the deletion of the snapshot, even if there are potential issues or dependencies. Use with extreme caution as this can lead to data inconsistency if not fully understood.

--children <boolean>
    If set to 1 (true), all direct and indirect children (descendants) of the specified snapshot will also be deleted recursively. This option is useful for cleaning up an entire branch of the snapshot tree. Introduced in Proxmox VE 7.2.

DESCRIPTION

The qm-delsnapshot command, part of the Proxmox Virtual Environment (PVE) toolkit, is used to remove existing snapshots of a KVM virtual machine or LXC container. A snapshot captures the complete state of a VM or container at a specific point in time, including its configuration, disk images, and optionally memory state. Deleting a snapshot frees up the disk space occupied by the snapshot's delta changes and removes its entry from the snapshot history. This command is crucial for managing storage space, cleaning up old or unnecessary recovery points, and maintaining a streamlined snapshot history. It ensures that the VM's or container's state and data are no longer tied to that specific snapshot point, allowing for better resource management and system organization.

CAVEATS

Deleting snapshots frees disk space, but the actual space reclamation might depend on the underlying storage technology (e.g., ZFS, LVM thin, QCOW2) and might not be immediately apparent.
Carefully consider the snapshot hierarchy. Deleting a parent snapshot without the --children option might render its child snapshots unusable if they depend on the parent's data, although Proxmox usually prevents this or merges data where possible. Using --children will remove the entire branch.
Ensure the VM or container is not currently rolled back to or running on the snapshot you intend to delete, as this could lead to unexpected behavior or data loss.
Always double-check the vmid and snapname to prevent accidental deletion of important snapshots.

SNAPSHOT TYPES AND DEPENDENCIES

Proxmox snapshots can include disk state and optionally memory state. Disk snapshots are typically differential, storing only changes since the previous snapshot or the base disk. This creates a dependency chain, where deleting a snapshot can impact subsequent snapshots. Understanding this chain is crucial for effective snapshot management.

STORAGE BACKEND IMPACT

The behavior of qm-delsnapshot can subtly differ based on the underlying storage backend. For instance, ZFS snapshots are native filesystem snapshots, while LVM thin provisioned volumes use LVM snapshots, and QCOW2 images manage their own internal snapshots. Each backend handles block allocation and deallocation differently when a snapshot is deleted, influencing performance and space reclamation.

HISTORY

Snapshot management has been a core feature of Proxmox VE since its early versions, essential for backup and recovery strategies. The qm-delsnapshot command, along with its counterparts for creation and listing, has evolved to provide robust point-in-time recovery capabilities. The introduction of the --children option in Proxmox VE 7.2 enhanced the command's functionality by simplifying the deletion of entire snapshot branches, reflecting continuous improvements in snapshot tree management and user convenience.

SEE ALSO

qm(1), qm snapshot(1), qm listsnapshot(1), qm rollback(1), pct(1)

Copied to clipboard