Logo

Cheatsheets

Una colección de comandos que vale la pena tener cerca cuando toca construir, mantener o rescatar un sistema.

03 / homelab

Proxmox

Atajos para mantener nodos, almacenamiento y contenedores.

Proxmox Cheat Sheet

Common commands for Proxmox Server Administration.


Diagnostics

ip -br a                          # interfaces and IPs
ip route                          # default gateway
systemctl --failed                # failed services
journalctl -p 3 -b                # errors since last boot
dmesg -T --level=err,warn | tail  # kernel errors/warnings with timestamps
systemctl status pveproxy         # web UI service
ss -tlnp | grep 8006              # web UI listening on 8006

Web UI: https://<node-ip>:8006 (self-signed cert warning is expected).

Disk and RAID Health

lsblk -o NAME,SIZE,MODEL,MOUNTPOINT   # disk layout
cat /proc/mdstat                      # RAID status ([UU] = healthy)
mdadm --detail /dev/md0               # RAID details
smartctl -a /dev/sdX                  # full SMART report
smartctl -a /dev/sdX | grep -Ei "health|Reallocated|Pending|Uncorrectable|CRC"
smartctl -t long /dev/sdX             # start long self-test (runs in background)
smartctl -a /dev/sdX | grep -A5 "Self-test log"   # read test result
echo check > /sys/block/md0/md/sync_action        # verify RAID mirror
cat /sys/block/md0/md/mismatch_cnt                # should be 0 after check

Warning signs: I/O error in dmesg, non-zero Reallocated_Sector_Ct, Current_Pending_Sector, or Offline_Uncorrectable.

Storage

pvesm status                                  # list storages
pvesm list <storage>                          # contents of a storage
mkdir -p /library/backups                     # folder inside an existing mount
pvesm add dir backups --path /library/backups --content backup --is_mountpoint /library
pvesm remove <storage-id>                     # removes config only, data is kept
findmnt /path                                 # check if a path is a mount point

--is_mountpoint prevents writing to the system disk if the mount is missing.

Backups (vzdump)

# Single container
vzdump 100 --storage backups --mode stop --compress zstd

# All containers with retention
vzdump --all --storage backups --mode snapshot --compress zstd --prune-backups keep-daily=7

# List backup files
ls -lh /library/backups/dump/*.tar.zst

Modes: snapshot (falls back to suspend on directory storage), suspend, stop (downtime, most consistent).

Scheduled Backup Jobs (CLI)

pvesh create /cluster/backup \
  --id backup-weekly \
  --schedule "01:00" \
  --storage backups \
  --all 1 \
  --mode snapshot \
  --compress zstd \
  --prune-backups keep-daily=7 \
  --enabled 1

pvesh get /cluster/backup                              # list jobs
pvesh get /cluster/backup/<job-id>                     # job details
pvesh set /cluster/backup/<job-id> --prune-backups keep-daily=5
pvesh delete /cluster/backup/<job-id>
  • Specific containers: replace --all 1 with --vmid 111,112,113,114.
  • Schedule uses systemd calendar format, e.g. "mon..fri 02:30".
  • Retention options: keep-last, keep-daily, keep-weekly, keep-monthly, keep-yearly.
  • Jobs are stored in /etc/pve/jobs.cfg (use pvesh instead of editing by hand).
  • Retention applies per container and includes manual backups in the same storage.

Restore

pct restore <ID> /library/backups/dump/vzdump-lxc-<ID>-<timestamp>.tar.zst --force

--force overwrites the existing container. Stop it first if it is running.

Repair Containers (stop, fsck, start)

Always take a backup first, and check disk health before repairing.

# Single container
pct stop 100
pct fsck 100
pct start 100

# All containers
for id in $(pct list | awk 'NR>1{print $1}'); do
  echo "=== CT $id ==="
  pct stop $id 2>/dev/null
  pct fsck $id
  pct start $id
done

Never run fsck on a mounted filesystem. If a container fails with I/O error, restore it from backup.

Container Management

pct list                  # list containers
pct status <ID>           # status of one container
pct start|stop|reboot <ID>
pct enter <ID>            # shell inside container
pct config <ID>           # container configuration

Replace a Failed RAID1 Disk

mdadm /dev/md0 --fail /dev/sdX1 --remove /dev/sdX1   # mark failed and remove
# Replace the disk, then copy the partition table from the healthy disk:
sfdisk -d /dev/sdGOOD | sfdisk /dev/sdNEW
mdadm /dev/md0 --add /dev/sdNEW1                     # add and rebuild
watch cat /proc/mdstat                               # monitor rebuild

Double-check device names with lsblk before running these.

Firewall

ufw status verbose        # UFW rules
pve-firewall status       # Proxmox firewall
ufw allow 8006/tcp        # allow web UI

ICMP (ping) failures are usually network or IP issues, not port rules.

Notifications

Backup failure emails need a recipient: Datacenter > Permissions > Users > root > Email. Otherwise mail-to-root fails with “no recipients provided”.

Useful Paths

PathPurpose
/etc/network/interfacesNetwork and bridge config (vmbr0)
/etc/pve/jobs.cfgBackup job definitions
/etc/pve/storage.cfgStorage definitions
/etc/fstabPersistent mounts
/library/backups/dump/Backup files