How to Start Stop and List Proxmox VE Virtual Machines via the CLI

5
ASRock Rack Proxmox VE 8.1 HTML5 IKVM
ASRock Rack Proxmox VE 8.1 HTML5 IKVM

Sometimes, you cannot get to the Proxmox VE web GUI for one reason or another, or you simply prefer the CLI. We thought we would put the three basic commands you need in one place to start, stop, and list virtual machines in the Proxmox VE UI.

How to List Proxmox VE Virtual Machines via the CLI

Listing the virtual machines is perhaps the most important function. The listing gives you the VM name, but also the VMID

qm list

The output of this command will help a lot when it comes to finding VMs via the CLI. Here we can see VMID 100 is a pfSense VM.

Proxmox VE QM List
Proxmox VE QM List

This VMID, or 100 in this case, is the VMID we use for other qm commands.

How to Start Proxmox VE Virtual Machines via the CLI

Starting a VM in Promxox VE using the CLI, then using this VMID. Here, we can use qm start and then the VMID for the virtual machine to start it.

qm start VMID

Here is an example using that pfSense VM that has a VMID of 100.

Proxmox VE QM Start
Proxmox VE QM Start

The qm start command usually takes a few seconds. After it returns to the prompt, you can do qm list again and verify it is running.

How to Stop Proxmox VE Virtual Machines via the CLI

Stopping VMs, there are a few methods that you need to be aware of. Shutdown, stop, and reset are all very important.

To shutdown the VM by sending the poweroff signal, use

qm shutdown VMID

If you want to stop a VM immediately, perhaps because it misbehaves, use the qm stop command instead.

qm stop VMID

Here is an example of the qm stop command using that pfSense VM with a VMID of 100:

Proxmox VE QM Stop
Proxmox VE QM Stop

A quick note here is that some VMs, especially those with old or funky OSes, might not respond to the qm shutdown command so you can instead use qm stop.

How to Suspend and Resume Proxmox VE Virtual Machines via the CLI

Sometimes you want to keep the state of a VM, but do not want to stop it. Instead, you would want to resume the virtual machine at a later time. That is where you would use qm suspend and qm resume commands.

qm suspend VMID

Here is the resume command:

qm resume VMID

Note here that both suspend and resume generally take a few seconds so if you see the shell pause for a few seconds, do not worry here.

How to Restart Proxmox VE Virtual Machines via the CLI

As you may have guessed by now, if you want to restart a Proxmox VE VM via the CLI, the command is:

qm restart VMID

Hopefully, that makes sense.

Final Words

Using the qm commands extends beyond Proxmox VE server. Proxmox VE uses KVM virtualization and qemu like other Linux virtualization setups. Still, the commands make a lot of sense so long as you remember “qm” is the command, and to find a VMID via the shell you would use the list command.

These days, the Proxmox VE web GUI is more stable, so this is less necessary, but it can be very helpful if you need to issue VM commands over the CLI in situations like ones with limited bandwidth or blocked web GUI access. These qm commands are also useful for scripting. If you have a VM that periodically just fails, you can use a cron job with qm restart, for example, to fix that issue.

Hopefully, this helps folks and is an easy reference if you ever need it.

5 COMMENTS

  1. Can you write an article/manual about how to transfer vm’s from VMware to Proxmox, please.

    This is very relevant with the current situation of VMware and Proxmox can replace it fully in my view.

  2. Re: transfer from VMWare ESXi. I’ve done this a long time ago. At that time I had to setup each VM hw by hand. AFAIr I used qemu-img to convert vmdk files to qcow for qemu to consume.

  3. Proxmox is failing short on one specific thing, namely the use of standard tools.
    It is disturbing not being able to just use virsh base commands, and that’s something I never really understood.
    In my opinion the future should be a smart hypervisor built on top as-standard-as-possible Linux, and that’s not what Proxmox seems to offer.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.