Post

Proxmox Cheatsheet

This page presents a list of commonly used commands for Proxmox.

Commands

VM Management

Basics

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
List VMs
qm list

Create or restore a virtual machine.
qm create <vmid>

Create or restore a virtual machine with core, memory, disks specified.
qm create <vmid> --name <vm-name> --cores <number-of-cores> --memory <memory-size-in-bytes> --scsi0 file=<vg-name>:<size-in-gb> --cdrom local:<iso-name> --net0 virtio,bridge=<bridge-name>

Start a VM
qm start <vmid>

Suspend virtual machine.
qm suspend <vmid>

Shutdown a VM
qm shutdown <vmid>

Reboot a VM
qm reboot <vmid>

Reset a VM
qm reset <vmid>

Stop a VM
qm stop <vmid>

Destroy the VM and all used/owned volumes.
Note: Removes any VM specific permissions and firewall rules
qm destroy <vmid>

Enter Qemu Monitor interface.
qm monitor <vmid>

Get the virtual machine configuration with both current and pending values.
qm pending <vmid>

Send key event to virtual machine.
qm sendkey <vmid> <key> [OPTIONS]

Show command line which is used to start the VM (debug info).
qm showcmd <vmid> [OPTIONS]

Unlock the VM.
qm unlock <vmid>

Clone a VM
qm clone <vmid> <newid>

Clone a VM in full clone mode and also set the name.
qm clone <vmid> <newid> --full --name <name>

Migrate a VM
qm migrate <vmid> <target-node>

Show VM status
qm status <vmid>

Clean up resources for a VM
qm cleanup <vmid> <clean-shutdown> <guest-requested>

Create a Template.
qm template <vmid> [OPTIONS]

Set virtual machine options (synchrounous API)
qm set <vmid> [OPTIONS]

Cloudinit

1
2
3
4
5
6
7
8
Get automatically generated cloudinit config.
qm cloudinit dump <vmid> <type>

Get the cloudinit configuration with both current and pending values.
qm cloudinit pending <vmid>

Regenerate and change cloudinit config drive.
qm cloudinit update <vmid>

Disk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Import an external disk image as an unused disk in a VM.
Note: The image format has to be supported by qemu-img(1).
qm disk import <vmid> <source> <storage>

Move volume to different storage or to a different VM.
qm disk move <vmid> <disk> [<storage>] [OPTIONS]

Rescan all storages and update disk sizes and unused disk images.
qm disk rescan [OPTIONS]

Extend volume size.
qm disk resize <vmid> <disk> <size> [OPTIONS]

Unlink/delete disk images.
qm disk unlink <vmid> --idlist <string> [OPTIONS]

Rescan volumes
qm rescan

Snapshot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
List all snapshots.
qm listsnapshot <vmid>

Snapshot a VM
qm snapshot <vmid> <snapname>

Delete a snapshot.
qm delsnapshot <vmid> <snapname>

Rollback a snapshot
qm rollback <vmid> <snapname>

Open a terminal using a serial device
(The VM need to have a serial device configured, for example serial0: socket)
qm terminal <vmid> [OPTIONS]

Proxy VM VNC traffic to stdin/stdout
qm vncproxy <vmid>

Others

1
2
3
4
5
6
7
8
9
10
11
Execute Qemu Guest Agent commands.
qm guest cmd <vmid> <command>

Executes the given command via the guest agent
qm guest exec <vmid> [<extra-args>] [OPTIONS]

Gets the status of the given pid started by the guest-agent
qm guest exec-status <vmid> <pid>

Sets the password for the given user to the given password
qm guest passwd <vmid> <username> [OPTIONS]

PV, VG & LV Management

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Create a PV
pvcreate <disk-device-name>

Remove a PV
pvremove <disk-device-name>

List all PVs
pvs

Create a VG
vgcreate <vg-name> <disk-device-name>

Remove a VG
vgremove <vg-name>

List all VGs
vgs

Create a LV
lvcreate -L <lv-size> -n <lv-name> <vg-name>

Remove a LV
lvremove <vg-name>/<lv-name>

List all LVs
lvs

Storage Management

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Create a new storage.
pvesm add <type> <storage> [OPTIONS]

Allocate disk images.
pvesm alloc <storage> <vmid> <filename> <size> [OPTIONS]

Delete volume
pvesm free <volume> [OPTIONS]

Delete storage configuration.
pvesm remove <storage>

List storage content.
pvesm list <storage> [OPTIONS]

An alias for pvesm scan lvm.
pvesm lvmscan

An alias for pvesm scan lvmthin.
pvesm lvmthinscan

List local LVM volume groups.
pvesm scan lvm

List local LVM Thin Pools.
pvesm scan lvmthin <vg>

Get status for all datastores.
pvesm status [OPTIONS]

Template Management

1
2
3
4
5
6
7
8
9
10
11
12
13
14
List All Templates
pveam available

List All Templates
pveam list <storage>

Download Appliance Templates
pveam download <storage> <template>

Remove a Template
pveam remove <template-path>

Update Container Template Database.
pveam update

Container Management

Basics

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
List Containers
pct list

Create or Restore a Container
pct create <vmid> <ostemplate> [OPTIONS]

Start the Container
pct start <vmid> [OPTIONS]

Create a Container Clone/Copy
pct clone <vmid> <newid> [OPTIONS]

Suspend the Container - This is Experimental
pct suspend <vmid>

Resume the Container
pct resume <vmid>

Stop the Container
This will abruptly stop all processes running in the container.
pct stop <vmid> [OPTIONS]

Shutdown the Container
This will trigger a clean shutdown of the container, see lxc-stop(1) for details
pct shutdown <vmid> [OPTIONS]

Destroy the Container (Also Delete All Uses Files)
pct destroy <vmid> [OPTIONS]

Show CT Status
pct status <vmid> [OPTIONS]

Migrate the Container to Another Node. Creates a New Bigration Task
pct migrate <vmid> <target> [OPTIONS]

Get Container Configuration
pct config <vmid> [OPTIONS]

Print the List of Assigned CPU Sets
pct cpusets

Get Container Configuration, Including Pending Changes
pct pending <vmid>

Reboot the Container by Shutting it Down, and Starting it Again. Applies Pending Changes.
pct reboot <vmid> [OPTIONS]

Create or Restore a Container
pct restore <vmid> <ostemplate> [OPTIONS]

Set Container Options
pct set <vmid> [OPTIONS]

Create a Template.
pct template <vmid>

Unlock the VM.
pct unlock <vmid>

Disk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Get the Container’s Current Disk Usage
pct df <vmid>

Run a Filesystem Check (fsck) on a Container Volume
pct fsck <vmid> [OPTIONS]

Run fstrim on a Chosen CT and Its Mountpoints
pct fstrim <vmid> [OPTIONS]

Mount the Container’s Filesystem on the Host
This will hold a lock on the container and is meant for emergency maintenance only
as it will prevent further operations on the container other than start and stop.
pct mount <vmid>

Move a rootfs-/mp-Volume to a Different Storage or to a Different Container
pct move-volume <vmid> <volume> [<storage>] [<target-vmid>] [<target-volume>] [OPTIONS]

Unmount the Container’s Filesystem
pct unmount <vmid>

Resize a Container Mount Point
pct resize <vmid> <disk> <size> [OPTIONS]

Rescan All Storages and Update Disk Sizes and Unused Disk Images
pct rescan [OPTIONS]

Launch a Console for the Specified Container
pct console <vmid> [OPTIONS]

Launch a Shell for the Specified Container
pct enter <vmid>

Launch a Command Inside the Specified Container
pct exec <vmid> [<extra-args>]

Copy a File from the Container to the Local System
pct pull <vmid> <path> <destination> [OPTIONS]

Copy a Local File to the Container
pct push <vmid> <file> <destination> [OPTIONS]

Snapshot

1
2
3
4
5
6
7
8
9
10
11
Snapshot a Container
pct snapshot <vmid> <snapname> [OPTIONS]

List all Snapshots
pct listsnapshot <vmid>

Rollback LXC State to Specified Snapshot
pct rollback <vmid> <snapname> [OPTIONS]

Delete a LXC Snapshot
pct delsnapshot <vmid> <snapname> [OPTIONS]

Web GUI

1
2
# Restart Web GUI
service pveproxy restart

Important File/Dir Path

PVE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/etc/pve/authkey.pub			        Public key used by the ticket system
/etc/pve/ceph.conf			        Ceph configuration file (note: /etc/ceph/ceph.conf is a symbolic link to this)
/etc/pve/corosync.conf				Corosync cluster configuration file (prior to Proxmox VE 4.x, this file was called cluster.conf)
/etc/pve/datacenter.cfg				Proxmox VE data center-wide configuration (keyboard layout, proxy, …)
/etc/pve/domains.cfg				Proxmox VE authentication domains
/etc/pve/firewall/cluster.fw			Firewall configuration applied to all nodes
/etc/pve/firewall/<NAME>.fw			Firewall configuration for individual nodes
/etc/pve/firewall/<VMID>.fw			Firewall configuration for VMs and containers
/etc/pve/ha/crm_commands			Displays HA operations that are currently being carried out by the CRM
/etc/pve/ha/manager_status			JSON-formatted information regarding HA services on the cluster
/etc/pve/ha/resources.cfg			Resources managed by high availability, and their current state
/etc/pve/nodes/<NAME>/config			Node-specific configuration
/etc/pve/nodes/<NAME>/lxc/<VMID>.conf		VM configuration data for LXC containers
/etc/pve/nodes/<NAME>/openvz/			Prior to PVE 4.0, used for container configuration data (deprecated, removed soon)
/etc/pve/nodes/<NAME>/pve-ssl.key		Private SSL key for pve-ssl.pem
/etc/pve/nodes/<NAME>/pve-ssl.pem		Public SSL certificate for web server (signed by cluster CA)
/etc/pve/nodes/<NAME>/pveproxy-ssl.key		Private SSL key for pveproxy-ssl.pem (optional)
/etc/pve/nodes/<NAME>/pveproxy-ssl.pem		Public SSL certificate (chain) for web server (optional override for pve-ssl.pem)
/etc/pve/nodes/<NAME>/qemu-server/<VMID>.conf	VM configuration data for KVM VMs
/etc/pve/priv/authkey.key			Private key used by ticket system
/etc/pve/priv/authorized_keys                   SH keys of cluster members for authentication
/etc/pve/priv/ceph*				Ceph authentication keys and associated capabilities
/etc/pve/priv/known_hosts			SSH keys of the cluster members for verification
/etc/pve/priv/lock/*				Lock files used by various services to ensure safe cluster-wide operations
/etc/pve/priv/pve-root-ca.key			Private key of cluster CA
/etc/pve/priv/shadow.cfg			Shadow password file for PVE Realm users
/etc/pve/priv/storage/<STORAGE-ID>.pw		Contains the password of a storage in plain text
/etc/pve/priv/tfa.cfg				Base64-encoded two-factor authentication configuration
/etc/pve/priv/token.cfg				API token secrets of all tokens
/etc/pve/pve-root-ca.pem			Public certificate of cluster CA
/etc/pve/pve-www.key		    	        Private key used for generating CSRF tokens
/etc/pve/sdn/*					Shared configuration files for Software Defined Networking (SDN)
/etc/pve/status.cfg				Proxmox VE external metrics server configuration
/etc/pve/storage.cfg			        Proxmox VE storage configuration
/etc/pve/user.cfg				Proxmox VE access control configuration (users/groups/…)
/etc/pve/virtual-guest/cpu-models.conf		For storing custom CPU models
/etc/pve/vzdump.cron				Cluster-wide vzdump backup-job schedule

Debug

1
2
3
4
5
/etc/pve/.version		File Versions (to detect file modifications)
/etc/pve/.members		Info about Cluster Members
/etc/pve/.vmlist		List of all VMs
/etc/pve/.clusterlog    	Cluster Log (last 50 entries)
/etc/pve/.rrd			RRD Data (most recent entries)

OpenVZ Section

1
2
3
4
5
/etc/vz/conf/xxx.conf			config
/var/lib/vz/root/xxx			data
/var/lib/vz/template/cache		template
/var/lib/vz/dump			snapshot
/etc/vz/vz.conf				OpenVZ config

KVM Section

1
2
3
/var/lib/vz/images/xxx			data
/var/lib/vz/template/iso		template
/var/lib/vz/dump			snapshot

LXC Section

1
2
3
4
/var/lib/lxc/xxx/config			config
/var/lib/vz/images/xxx			data
/var/lib/vz/template/cache		template
/var/lib/vz/dump			snapshot
This post is licensed under CC BY 4.0 by the author.