LinuxCommandLibrary

qm

Manage QEMU virtual machines and containers

TLDR

List all virtual machines

$ qm list
copy

Using an ISO file uploaded on the local storage, create a virtual machine with a 4 GB SCSI disk on the local-lvm storage and an ID of 100
$ qm [[cr|create]] [100] --scsi0 [local-lvm:4] --net0 [e1000] --cdrom [local:iso/proxmox-mailgateway_2.1.iso]
copy

Show the configuration of a virtual machine, specifying its ID
$ qm [[co|config]] [100]
copy

Start a specific virtual machine
$ qm start [100]
copy

Send a shutdown request, then wait until the virtual machine is stopped
$ qm [[shu|shutdown]] [100] && qm [[w|wait]] [100]
copy

Destroy a virtual machine and remove all related resources
$ qm [[des|destroy]] [100] --purge
copy

SYNOPSIS

qm <subcommand> [<vmid>] [<options>] [<args>]

PARAMETERS

create <vmid> <options>
    Creates a new KVM virtual machine with specified VMID and configuration options.

start <vmid>
    Starts the specified virtual machine.

stop <vmid>
    Immediately stops the specified virtual machine, similar to pulling the power plug.

shutdown <vmid>
    Gracefully shuts down the specified virtual machine (requires guest agent or ACPI).

status <vmid>
    Displays the current status of a virtual machine (e.g., running, stopped, paused).

list
    Lists all virtual machines and containers on the system with their status and other details.

config <vmid>
    Displays the current configuration of a virtual machine.

set <vmid> <options>
    Modifies one or more configuration options for a virtual machine.

migrate <vmid> <target_node> <options>
    Migrates a virtual machine to another Proxmox VE node in the cluster.

backup <vmid> <options>
    Creates a backup of the specified virtual machine to a configured storage.

restore <vmid> <filepath> <options>
    Restores a virtual machine from a backup file.

destroy <vmid>
    Permanently deletes a virtual machine and all its associated data.

clone <vmid> <new_vmid> <options>
    Creates a clone of an existing virtual machine.

DESCRIPTION

qm is the primary command-line utility for managing virtual machines (KVM) and Linux containers (LXC) within a Proxmox Virtual Environment (PVE) installation. It provides a comprehensive set of subcommands to perform almost any administrative task related to VMs and containers, including creation, starting, stopping, configuration, migration, backup, and restoration.

As a high-level wrapper around QEMU/KVM and LXC, qm simplifies complex operations, interacting directly with the underlying Proxmox API and services. It's an indispensable tool for administrators managing Proxmox VE servers, offering detailed control over virtualized resources, storage, and networking.

CAVEATS

The qm command is specific to Proxmox Virtual Environment (PVE) installations and is not a standard Linux command found on general-purpose distributions. It requires a PVE installation to be present and typically needs root privileges or appropriate sudo permissions to execute. Incorrect usage, especially with subcommands like destroy or set, can lead to data loss or system instability.

VMID (VIRTUAL MACHINE ID)

Most qm subcommands require a VMID, which is a unique integer identifier for each virtual machine or container in Proxmox VE. These IDs typically range from 100 to 999999999, and are used to refer to a specific VM or container when executing commands.

ACCESSING MANPAGES

For detailed information on any specific subcommand and its options, use qm help <subcommand> or consult the comprehensive manpage using man qm on a Proxmox VE system.

HISTORY

The qm command is an integral part of Proxmox Virtual Environment, a Debian-based Linux distribution for virtualization. Proxmox VE was first released in 2007, and qm has been its primary command-line interface for managing KVM-based virtual machines since its early versions. Its development closely follows the evolution of Proxmox VE, incorporating new features and improvements with each major release, reflecting advancements in QEMU/KVM and LXC technologies. It serves as a user-friendly wrapper for the complex underlying virtualization commands and APIs.

SEE ALSO

Copied to clipboard