qm
Manage QEMU virtual machines and containers
TLDR
List all virtual machines
Using an ISO file uploaded on the local storage, create a virtual machine with a 4 GB IDE disk on the local-lvm storage and an ID of 100
Show the configuration of a virtual machine, specifying its ID
Start a specific virtual machine
Send a shutdown request, then wait until the virtual machine is stopped
Destroy a virtual machine and remove all related resources
SYNOPSIS
qm
PARAMETERS
create
Create a new VM with the specified ID.
destroy
Destroy the VM with the specified ID. This action is irreversible.
start
Start the VM with the specified ID.
stop
Stop the VM with the specified ID. (ACPI shutdown)
shutdown
Shut down the VM with the specified ID.
reset
Reset the VM with the specified ID.
suspend
Suspend the VM with the specified ID.
resume
Resume the suspended VM with the specified ID.
migrate
Migrate the VM with the specified ID to the specified target node.
clone
Clone the VM with the specified ID, creating a new VM with the specified new ID.
snapshot
Create a snapshot of VM
rollback
Rollback to VM snapshot
restore
Restore a VM with the specified ID from the specified backup file.
config
Display the configuration of the VM with the specified ID.
status
Display the status of the VM with the specified ID.
monitor
Attach QEMU monitor console.
--name
Specify a name for the VM.
--memory
Specify the amount of memory (in MB) for the VM.
--net0
Configure the first network interface. Example: net0=virtio,bridge=vmbr0
--ostype
Specify the operating system type. Example: --ostype l26 (for Linux 2.6 kernel and above)
--ide0
Specify an IDE disk. Example: --ide0 local:32
--scsi0
Specify an SCSI disk. Example: --scsi0 local:32
--sockets
Number of CPU sockets.
--cores
Number of CPU cores per socket.
--vga
Type of vga interface. Example --vga std.
--onboot <0|1>
Start VM on boot.
DESCRIPTION
The qm command is a powerful tool in Proxmox Virtual Environment (PVE) for managing QEMU virtual machines directly from the command line. It provides a comprehensive set of options for creating, configuring, starting, stopping, migrating, backing up, and restoring VMs. qm interacts with the PVE API to perform these actions, offering a flexible and efficient way to administer virtual machines, especially in automated scripts or when GUI access is limited.
With qm you can perform several actions:
- Create a VM
- Manage CPU, disk and memory
- Cloning the VM
- Restore a backup
- Manage snapshopts
CAVEATS
The qm command relies on the Proxmox Virtual Environment being properly configured. Ensure that the PVE cluster is healthy and that storage is correctly set up before performing operations like creating, restoring, or migrating VMs. Backups are essential before performing any destructive action.
NETWORKING CONFIGURATION
When configuring network interfaces, ensure the specified bridge exists on the Proxmox host. Using the wrong bridge or incorrect parameters can lead to network connectivity issues for the VM.
Example: `qm set 100 --net0 virtio,bridge=vmbr0`
STORAGE CONFIGURATION
qm supports various storage types (local, NFS, iSCSI, etc.). When specifying disk size, use the correct storage type and ensure sufficient space is available on the specified storage.
Example: `qm create 101 --ide0 local:32`
BACKUP AND RESTORE
Before performing any major changes on the VM, create backups. The restore operation creates a new VM. You have to remove old VM before.
Example Backup: `vzdump 100`
Example Restore: `qm restore 101 vzdump-qemu-100-2024_05_02-10_00_00.vma`
HISTORY
qm is part of the Proxmox VE suite, designed to manage virtual machines based on KVM and containers based on LXC. It evolved to provide a CLI interface to the PVE API, allowing for automated and scripted management of virtualized resources. The command has been refined and extended with each release of Proxmox VE to support new features and improvements.
SEE ALSO
pct(1), pvesh(1), vzctl(1) - openvz