LinuxCommandLibrary

qm-suspend

Suspend a Qemu/KVM virtual machine

TLDR

Suspend a virtual machine by ID

$ qm [[su|suspend]] [vm_id] [integer]
copy

Skip the lock check when suspending the VM
$ qm [[su|suspend]] [vm_id] [integer] --skiplock
copy

Skip the lock check for storage when suspending the VM
$ qm [[su|suspend]] [vm_id] [integer] --skiplockstorage
copy

SYNOPSIS

qm suspend <vmid> [OPTIONS]

PARAMETERS

<vmid>
    The ID of the virtual machine to suspend.

--todisk <boolean>
    Specify whether to suspend the VM to disk (1/true) or to RAM (0/false). Default is 1 (to disk).

--force <boolean>
    Force suspend the VM, even if its current state might not typically allow it. Use with caution.

--keep-cpu-hotplug-state <boolean>
    If set to 1, keep the CPU hotplug state. Otherwise, reset it after suspend.

--keep-qemu-process <boolean>
    If set to 1, keep the QEMU process running after the VM state is suspended. Useful for debugging.

DESCRIPTION

qm-suspend is a utility provided by Proxmox VE to suspend a running QEMU/KVM virtual machine. Suspending a VM involves saving its current state (memory, CPU registers, devices) to a file or keeping it in RAM, allowing it to be resumed later from the exact point it was suspended. This is useful for saving power, freeing up resources temporarily, or for migrating a VM without shutting it down.

When suspended to disk, the VM's entire state is written to a file, making it persistent even after a host reboot. When suspended to RAM, the state is held in the host's memory, offering faster suspend/resume times but losing the state if the host reboots or loses power. The command requires the VMID (Virtual Machine ID) as a mandatory argument. It's an essential tool for managing the lifecycle of virtual machines in a Proxmox environment, providing flexibility for maintenance, resource optimization, and high availability strategies.

CAVEATS

Suspending to RAM (--todisk 0) means the VM state is lost if the host reboots or loses power.
Suspending large VMs to disk can take significant time and requires sufficient free disk space.
Not all applications or workloads inside the VM handle suspension gracefully; active network connections or time-sensitive processes might break.
This command is for QEMU/KVM virtual machines only; LXC containers cannot be suspended using qm-suspend.

SUSPEND TYPES EXPLAINED

When suspending a VM, you have two primary options: to disk or to RAM. Suspending to disk saves the VM's entire state to a file on the host's storage. This makes the state persistent across host reboots but requires sufficient disk space and can take longer for large VMs. Suspending to RAM keeps the VM's state in the host's memory. This offers much faster suspend and resume times but is volatile; the VM state will be lost if the host loses power or reboots. By default, qm-suspend performs a suspend to disk.

RESUMING A SUSPENDED VM

A VM suspended using qm-suspend can be brought back to its exact previous state using the qm resume command. It's important to use qm resume specifically for suspended VMs, rather than qm start, as qm start would boot the VM from scratch, ignoring any suspended state and potentially leading to data inconsistencies.

HISTORY

qm-suspend is an intrinsic command within the Proxmox VE virtualization platform, which has been under continuous development since its inception in the mid-2000s. Its functionality directly leverages QEMU/KVM's capabilities for saving and restoring VM states, a feature that has evolved significantly alongside advancements in virtualization technologies. As a core VM lifecycle management tool, it has been available as long as Proxmox VE has supported QEMU/KVM, adapting to new QEMU features and Proxmox management paradigms.

SEE ALSO

qm(1), qm-resume(1), qm-start(1), qm-stop(1), qm-reset(1)

Copied to clipboard