Backup and Restore

Help and Info~5 minView script

Curated reference of vzdump, qmrestore and pct restore commands for Proxmox backup workflows. Includes scheduling, advanced options like hook scripts / exclude paths / I/O priority, and backup file management.

Three backup modes

For VMs, snapshot is a live backup and does not require storage snapshots. suspend pauses the VM before the live backup and does not necessarily improve consistency. stop shuts the VM down first; a previously running VM can resume once backup has started. LXC differs: snapshot mode requires snapshot-capable storage, suspend uses two rsync passes, and stop keeps the container stopped during backup.

VM Backup

CommandDescriptionAction
vzdump <vmid>Create a backup of a specific VM/CT
vzdump <vmid> --storage <storage>Backup VM to specific storage
vzdump <vmid> --mode snapshotCreate snapshot backup (for VMs)
vzdump <vmid> --mode suspendPause VM before the live backup (legacy suspend mode)
vzdump <vmid> --mode stopShut down VM before starting the backup
vzdump --allBackup all VMs and containers
vzdump --all --exclude <vmid1>,<vmid2>Backup all except specified VMs

Backup Options

CommandDescriptionAction
vzdump <vmid> --compress zstdUse zstd compression for backup
vzdump <vmid> --compress gzip --pigz <threads>Use pigz with multiple threads
vzdump <vmid> --storage <storage> --notes-template <text>Add notes to backup
vzdump <vmid> --mailto <email>Send notification email
vzdump <vmid> --prune-backups keep-last=<n>Keep only n backups per VM
vzdump <vmid> --stdexcludes 0Don't exclude temporary files
vzdump <vmid> --quiet 1Suppress output messages

Restore Backups

CommandDescriptionAction
qmrestore <backup-file> <vmid>Restore VM from backup
qmrestore <backup-file> <vmid> --storage <storage>Restore to specific storage
qmrestore <backup-file> <vmid> --uniqueRestore VM with newly generated random MAC addresses
pct restore <vmid> <backup-file>Restore container from backup
pct restore <vmid> <backup-file> --storage <storage>Restore container to specific storage
pct restore <vmid> <backup-file> --rootfs <storage>:<size-GiB>Restore with a root disk allocated on the chosen storage and size
pct restore <vmid> <backup-file> --unprivileged 1Restore as unprivileged CT

Backup Management

CommandDescriptionAction
ls -la /var/lib/vz/dump/List backups in default location
find /var/lib/vz/dump/ -name "*.vma*"Find VM backups
find /var/lib/vz/dump/ -name "*.tar*"Find container backups
pvesm list <storage> --content backupList backups in specific storage
rm /var/lib/vz/dump/<backup-file>Delete a backup file
cat /etc/vzdump.confShow backup configuration

Scheduled Backups

CommandDescriptionAction
cat /etc/pve/jobs.cfgShow backup schedule
nano /etc/vzdump.confEdit backup configuration
systemctl list-timersList systemd timers
systemctl status cronCheck cron service status
pvenode task list --typefilter vzdumpList completed backup tasks
pvenode task log <upid>Show the log for a backup task UPID

Advanced Operations

CommandDescriptionAction
qmrestore <backup> <vmid> --forceForce restore, overwriting existing VM
vzdump <vmid> --dumpdir <directory>Specify custom backup directory
vzdump <vmid> --script <script>Run hook script during backup
vzdump <vmid> --exclude-path <path>Exclude specific paths from backup
vzdump <vmid> --ionice <priority>Set I/O priority for backup process
vzdump <vmid> --lockwait <minutes>Wait for lock
qm importdisk <vmid> <disk-image> <storage>Import a disk image file (for example raw, qcow2 or vmdk) as an unused disk, not a vzdump backup archive

Test your restores

Periodically restore a backup to an unused test VMID with qmrestore --unique, start the VM on an isolated test network and check its contents. The unique option generates new MAC addresses; it does not change static IPs or application settings. Test container restores with pct restore in the same way.

Related