qm Command Examples in Linux

qm is a command-line tool provided by the QEMU/KVM Virtual Machine Manager for managing virtual machines on Linux systems. QEMU (Quick Emulator) is a free and open-source emulator that can run virtual machines for various architectures and devices, while KVM (Kernel-based Virtual Machine) is a Linux kernel module that provides virtualization support for QEMU.

With qm, users can create, delete, start, stop, and manage virtual machines running on QEMU/KVM. The qm command provides a variety of options and subcommands for managing virtual machines, such as create, start, stop, destroy, snapshot, migrate, and wait.

Other commonly used qm commands include:

  • qm start [vmid]: Start a virtual machine with the specified ID.
  • qm stop [vmid]: Stop a virtual machine with the specified ID.
  • qm destroy [vmid]: Permanently remove a virtual machine with the specified ID.
  • qm snapshot [vmid] [name]: Create a snapshot of a virtual machine with the specified ID and give it the specified name.
  • qm migrate [vmid] [target]: Migrate a virtual machine with the specified ID to another host or storage location.

The QEMU/KVM Virtual Machine Manager provides a powerful and flexible platform for managing virtual machines on Linux systems. More information about the qm command and other features of the QEMU/KVM Virtual Machine Manager can be found in the project’s documentation at https://pve.proxmox.com/pve-docs/qm.1.html.

qm Command Examples

1. List all virtual machines:

# qm list

2. 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:

# qm create {{100}} -ide0 {{local-lvm:4}} -net0 {{e1000}} -cdrom {{local:iso/proxmox-mailgateway_2.1.iso}}

3. Show the configuration of a virtual machine, specifying its ID:

# qm config {{100}}

4. Start a specific virtual machine:

# qm start {{100}}

5. Send a shutdown request, then wait until the virtual machine is stopped:

# qm shutdown {{100}} && qm wait {{100}}

6. Destroy a virtual machine and remove all related resources:

# qm destroy {{100}} --purge
Related Post