10.12. Managing Virtual Machines with qm

qm is the tool to manage Qemu/Kvm virtual machines on Proxmox VE. You can create and destroy virtual machines, and control execution (start/stop/suspend/resume). Besides that, you can use qm to set parameters in the associated config file. It is also possible to create and delete virtual disks.

Using an iso file uploaded on the local storage, create a VM with a 4 GB IDE disk on the local-lvm storage

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

Start the new VM

# qm start 300

Send a shutdown request, then wait until the VM is stopped.

# qm shutdown 300 && qm wait 300

Same as above, but only wait for 40 seconds.

# qm shutdown 300 && qm wait 300 -timeout 40

Destroying a VM always removes it from Access Control Lists and it always removes the firewall configuration of the VM. You have to activate --purge, if you want to additionally remove the VM from replication jobs, backup jobs and HA resource configurations.

# qm destroy 300 --purge

Move a disk image to a different storage.

# qm move-disk 300 scsi0 other-storage

Reassign a disk image to a different VM. This will remove the disk scsi1 from the source VM and attaches it as scsi3 to the target VM. In the background the disk image is being renamed so that the name matches the new owner.

# qm move-disk 300 scsi1 --target-vmid 400 --target-disk scsi3