How to use the command qm suspend (with examples)
The qm suspend
command is used to suspend a virtual machine (VM) in the Proxmox Virtual Environment (PVE). When a VM is suspended, its state is saved to disk, allowing it to be resumed from where it left off at a later time.
Use case 1: Suspend a virtual machine by id
Code:
qm suspend 100
Motivation: In situations where you need to temporarily pause a virtual machine without shutting it down completely, you can use the qm suspend
command. This can be useful when you want to free up resources on the host machine or temporarily pause a specific workload.
Explanation: In this use case, the command qm suspend
is followed by the VM id (e.g., 100) which specifies the virtual machine to be suspended. The vm_id
argument should be replaced with the actual id of the VM you want to suspend.
Example output:
Suspension of virtual machine 100 in progress...
Virtual machine 100 has been suspended successfully.
Use case 2: Skip the lock check when suspending the VM
Code:
qm suspend 100 --skiplock
Motivation: By default, the qm suspend
command performs a lock check to ensure no other system processes are accessing the VM before it is suspended. However, in certain situations where you know it is safe to suspend the VM, you can skip this lock check to save time.
Explanation: In this use case, the --skiplock
flag is added to the command to skip the lock check. This should be used with caution, as skipping the lock check may lead to data corruption if other processes are accessing the VM simultaneously.
Example output:
Suspension of virtual machine 100 in progress...
Virtual machine 100 has been suspended successfully.
Use case 3: Skip the lock check for storage when suspending the VM
Code:
qm suspend 100 --skiplockstorage
Motivation: When suspending a VM, the --skiplockstorage
flag can be used to skip the lock check for storage. This can be helpful when you want to suspend the VM quickly, without waiting for the storage lock to be released.
Explanation: In this use case, the --skiplockstorage
flag is added to the command to skip the lock check for storage. This flag should also be used with caution, as it may lead to data corruption in certain situations.
Example output:
Suspension of virtual machine 100 in progress...
Virtual machine 100 has been suspended successfully.
Conclusion:
In this article, we have explored different use cases of the qm suspend
command in the Proxmox Virtual Environment. By knowing how to suspend a VM, skip the lock check, and skip the lock check for storage, you can effectively manage the state of your virtual machines and optimize resource utilization on your host machine. However, it is important to use caution when skipping lock checks to avoid potential data corruption.