# Proxmox CLI command reference Full command coverage for `qm`, `pct`, `pvesm`, `pvecm`, `pveam`, backup/ restore, networking, firewall, and troubleshooting. Adapted from `bastos/skills@proxmox-admin` (upstream source: see `SKILL.md` provenance note) with all example VMIDs, storage pool names, bridge names, and networks replaced by placeholders — **none of the values below are this fleet's real values.** Resolve real values from `docs/server-*.md` or from live discovery (`qm list`, `pvesm status`, etc.) before running anything. Read `SKILL.md` first — it has the safety workflow and the destructive- command tier list this reference assumes you already know. Everything in a "never run without confirmation" tier there is repeated here only as reference syntax, not as something to execute unattended. ## Tool overview | Tool | Purpose | |------|---------| | `qm` | Manage KVM virtual machines | | `pct` | Manage LXC containers | | `pvesm` | Manage storage | | `pvecm` | Manage cluster | | `pveam` | Manage appliance/template downloads | | `pvesh` | Access the Proxmox API from the shell | | `pveperf` | Benchmark host performance | ## VM management with `qm` ### Creating a VM (destructive tier: creates persistent state — confirm first) ```bash qm create --name --memory 2048 --cores 2 --sockets 1 \ --net0 virtio,bridge= --ostype l26 # SCSI disk on a given storage pool qm create --name --memory 4096 --cores 4 \ --scsi0 :32 --scsihw virtio-scsi-pci \ --net0 virtio,bridge= --ostype l26 # Attach an ISO for installation qm set --cdrom :iso/.iso --boot order=ide2 ``` ### VM lifecycle | Command | Purpose | Tier | |---------|---------|------| | `qm start ` | Start a VM | generally fine once target confirmed | | `qm shutdown ` | Graceful ACPI shutdown | generally fine | | `qm stop ` | Force stop (like pulling power) | confirm first — no ACPI grace | | `qm reboot ` | Reboot (ACPI-graceful) | can hang if guest unresponsive — see SKILL.md | | `qm reset ` | Hard reset | confirm clean unmount first — see SKILL.md | | `qm suspend ` | Suspend to RAM | confirm first | | `qm resume ` | Resume from suspend | generally fine | | `qm destroy ` | Delete VM and its disks | **never without human confirmation** | | `qm destroy --purge` | Delete VM, disks, and all related jobs | **never without human confirmation** | ### VM configuration ```bash qm config # show current config — always run before qm set qm set --memory 8192 qm set --cores 4 qm set --balloon 2048 # dynamic memory (min) qm set --cpu cputype=host # pass through host CPU features qm set --machine q35 # Q35 chipset (needed for PCIe passthrough) # Add/resize disks — check pvesm status for free space first qm set --scsi1 :50 # add a 50GB disk qm disk resize scsi0 +20G # grow an existing disk # Networking — and any VLAN tag are fleet-specific, resolve first qm set --net0 virtio,bridge=,tag= qm set --net1 virtio,bridge= # Cloud-init qm set --ide2 :cloudinit qm set --ciuser --cipassword '' qm set --ipconfig0 ip=/,gw= qm set --sshkeys ~/.ssh/authorized_keys qm set --boot order=scsi0 # EFI / UEFI boot qm set --bios ovmf --efidisk0 :1,efitype=4m,pre-enrolled-keys=1 # Serial console (headless) qm set --serial0 socket --vga serial0 # PCI passthrough qm set --hostpci0 ,pcie=1 ``` ### Snapshots and cloning See SKILL.md's "Snapshot vs. backup" section before relying on any of these as your only safety net. ```bash qm snapshot --description "" qm listsnapshot qm rollback qm delsnapshot qm clone --name --full # full copy qm clone --name # linked clone (shares base disk) ``` ### Templates ```bash qm template # convert VM to template — IRREVERSIBLE, confirm first qm clone --name # linked clone from template qm clone --name --full # full clone from template ``` ### Migration (confirm first — affects a second node) ```bash qm migrate --online # online (live) migration qm migrate # offline migration ``` ### Monitoring ```bash qm status qm list qm agent ping qm agent get-osinfo qm monitor # QEMU monitor console ``` ## Container management with `pct` ### Creating a container (destructive tier — confirm first) ```bash # Download a template first pveam update pveam available --section system pveam download pct create :vztmpl/ \ --hostname --memory 1024 --cores 2 \ --rootfs :8 \ --net0 name=eth0,bridge=,ip=dhcp \ --password '' --unprivileged 1 # Static IP variant pct create :vztmpl/ \ --hostname --memory 2048 --cores 2 \ --rootfs :16 \ --net0 name=eth0,bridge=,ip=/,gw= \ --nameserver --unprivileged 1 ``` ### Container lifecycle | Command | Purpose | Tier | |---------|---------|------| | `pct start ` | Start container | generally fine once target confirmed | | `pct shutdown ` | Graceful shutdown | generally fine | | `pct stop ` | Force stop | confirm first | | `pct reboot ` | Reboot container | same ACPI-hang caveat as `qm reboot` | | `pct destroy ` | Delete container and its volumes | **never without human confirmation** | | `pct enter ` | Open a shell inside the container | generally fine | | `pct exec -- ` | Run a command inside the container | depends what `` does | | `pct console ` | Attach to container console | generally fine | ### Container configuration ```bash pct config # always run before pct set pct set --memory 4096 pct set --cores 4 pct set --swap 1024 pct set --mp0 /mnt/data,mp=/data # bind mount from host pct set --mp1 :50,mp=/var/lib/data # additional storage volume pct set --net0 name=eth0,bridge=,ip=/,gw= pct set --net1 name=eth1,bridge=,ip=dhcp pct set --features nesting=1 pct set --features nesting=1,fuse=1,mount=nfs pct set --nameserver " " --searchdomain pct set --onboot 1 --startup order=1,up=30 ``` ### Container snapshots and cloning ```bash pct snapshot pct rollback pct clone --hostname --full ``` ## Storage management ```bash pvesm status # list pools + free space — check before any restore/resize pvesm list # content of a specific storage pool # Adding storage is a cluster-wide config mutation — confirm first pvesm add dir --path --content backup pvesm add nfs --server --export --content images,vztmpl pvesm add lvm --vgname --content rootdir,images pvesm add zfspool --pool / --content rootdir,images pvesm remove # never without human confirmation wget -P /var/lib/vz/template/iso/ ``` ## Networking ```bash cat /etc/network/interfaces # current bridge/interface config — read first # Bridge stanza shape (values are placeholders, not this fleet's real config) # auto # iface inet static # address / # bridge-ports # bridge-stp off # bridge-fd 0 ifreload -a # apply network changes — can drop connectivity if misconfigured, confirm first ``` ## Cluster management (all tiers below: confirm first — affects multiple nodes) ```bash pvecm create pvecm add pvecm status pvecm nodes pvecm delnode pvecm expected 1 # force quorum — single-node recovery only, real split-brain risk otherwise ``` ## Firewall ```bash pve-firewall start pve-firewall stop pve-firewall status # Datacenter: /etc/pve/firewall/cluster.fw ([OPTIONS] enable: 1) # Node: /etc/pve/nodes//host.fw # VM/CT: /etc/pve/firewall/.fw # # Add remote-management allow rules BEFORE enabling a restrictive default # policy — locking yourself out of remote access to the node is a real, # hard-to-recover-from failure mode. ``` ## Backup and restore ```bash vzdump --storage --mode snapshot --compress zstd vzdump --storage --mode stop --compress zstd vzdump --all --storage --mode snapshot --compress zstd --mailto # Restore — never without human confirmation (creates/overwrites a guest). # Check pvesm status for target free space FIRST, especially for large disks. qmrestore --storage pct restore ``` ## Common provisioning patterns (reference only — each step still follows the tier rules above) ### Cloud-init VM from a template ```bash qm template # irreversible — confirm first qm clone --name --full qm set --ciuser --sshkeys ~/.ssh/authorized_keys qm set --ipconfig0 ip=/,gw= qm set --nameserver qm start ``` Note: some Proxmox documentation and community examples use VMIDs like `9000` as a convention for template base images. That's a naming convention some operators adopt, not a Proxmox default or a value to copy into this fleet — check `docs/server-*.md` for whatever convention (if any) applies to a given host before picking an ID. ### Batch-create containers Bulk/loop patterns are explicitly a higher tier than the single-target equivalent (see SKILL.md) — pilot one iteration manually, confirm it's correct, before running the loop. ```bash for i in $(seq 1 ); do CTID=$(( + i)) pct create "$CTID" :vztmpl/ \ --hostname "-${i}" --memory 1024 --cores 2 \ --rootfs :8 \ --net0 name=eth0,bridge=,ip=.$(( + i))/,gw= \ --unprivileged 1 --start 1 done ``` ### Import a disk image (e.g. a cloud image) ```bash wget qm disk import qm set --scsi0 :vm--disk-0 qm set --boot order=scsi0 ``` ## Troubleshooting | Problem | Solution | |---------|----------| | VM won't start | `qm config `, verify storage exists with `pvesm status` | | "TASK ERROR: can't lock file" | Check for a genuinely running task first; if the task is gone, `qm unlock ` / `pct unlock ` | | Container has no network | Check bridge exists: `brctl show`; verify firewall rules | | Disk full on storage | `pvesm status` for usage; `lvs` for LVM thin pools | | Cluster quorum lost | `pvecm expected 1` on a surviving node — single-node recovery only, confirm first | | Migration fails | Check CPU type compatibility; confirm network reachability between nodes | | Backup fails with lock error | `qm unlock ` / `pct unlock ` | | Slow disk I/O in VM | `--scsihw virtio-scsi-single` plus disk options like `,iothread=1,discard=on` | | Guest agent not responding | Install `qemu-guest-agent` in the guest, then `qm set --agent 1` | | SSH/command seems to hit the wrong host | See SKILL.md's Tailscale hostname-collision gotcha — verify with `ssh -v 2>&1 \| grep "Connecting to"` | ## Useful paths | Path | Contents | |------|----------| | `/etc/pve/` | Cluster-wide config (pmxcfs) | | `/etc/pve/qemu-server/.conf` | VM configuration files | | `/etc/pve/lxc/.conf` | Container configuration files | | `/etc/pve/storage.cfg` | Storage definitions | | `/etc/pve/nodes/` | Per-node configuration | | `/var/lib/vz/` | Default local storage root | | `/var/lib/vz/template/iso/` | ISO images | | `/var/lib/vz/template/cache/` | Container templates | | `/var/lib/vz/dump/` | Backup files | | `/var/log/pve/tasks/` | Task logs |