Proxmox主机级备份配置最佳方案咨询
Hey there! Let's walk through the most reliable ways to cover all your backup needs—from Proxmox host settings to VMs and recurring tasks—based on what you're looking to achieve.
1. Backup Proxmox Host Core Configurations
Proxmox's critical settings live in a few key places; backing these up ensures you can quickly restore the host environment if needed:
- Cluster/VM/Storage Database: The
config.dbfile at/var/lib/pve-cluster/config.dbis the single source of truth for all Proxmox cluster, VM, storage, and network configurations. This is non-negotiable to backup. - Network & System Files: Don't forget
/etc/network/interfaces(network configs),/etc/hosts,/etc/resolv.conf, and apt source files like/etc/apt/sources.list.d/pve*.list—these keep your host connected and updated correctly. - User & Permission Configs: If you have custom users or permissions, backup
/etc/passwd,/etc/group, and/etc/shadow(note:/etc/shadowrequires root access to read).
For a quick one-liner to bundle these into a timestamped archive:
sudo tar -czf proxmox-host-backup-$(date +%Y%m%d-%H%M).tar.gz /var/lib/pve-cluster/config.db /etc/network/interfaces /etc/hosts /etc/resolv.conf /etc/apt/sources.list.d/pve*.list /etc/passwd /etc/group /etc/shadow
2. Backup Important Custom Files & Configs
For your own scripts, data files, or app-specific configs on the Proxmox host:
- Use
rsyncto sync files to a dedicated backup storage (like an NFS share or external drive) regularly. Example:rsync -avz /path/to/your/important/files/ /mnt/backup-storage/proxmox-custom-files/ - Alternatively, add these paths to the tar command above to bundle them with your host config backup.
3. Integrate VM Snapshots & Recurring Backups
Proxmox's built-in tools make this straightforward, and you can combine snapshots with scheduled backups:
Option A: Use Proxmox WebUI Scheduled Backups (Simplest)
- Go to Datacenter > Backup and create a new backup job.
- Choose which VMs/CTs to include, select your backup storage (preferably external to the host), and set a schedule (daily/weekly/monthly).
- For backup mode:
- Snapshot Mode: Takes a live snapshot of the VM/CT (no downtime) and backs it up—great for production VMs.
- Stop Mode: Shuts down the VM/CT first for a consistent backup (best for databases or write-heavy workloads).
- Set a retention policy (e.g., keep 7 daily backups, 4 weekly backups) to avoid filling up storage.
Option B: Combine Manual Snapshots with Scripted Backups
If you want to keep specific snapshots long-term:
- Create manual snapshots via the VM's Snapshots tab in the WebUI, or use the command:
qm snapshot <vm-id> "snapshot-name" --description "Pre-upgrade backup" - Then, use
vzdumpto backup the specific snapshot (instead of the current VM state):vzdump <vm-id> --snapshot "snapshot-name" --storage backup-storage --mode snapshot
4. Automate Recurring Backups for Everything
To tie host configs, custom files, and VM backups into a single recurring job:
- Create a bash script (e.g.,
proxmox-full-backup.sh) that runs the host config tar command, rsyncs custom files, and triggersvzdumpfor your VMs. - Add a cron job to run this script on your desired schedule. For example, to run daily at 2 AM:
sudo crontab -e # Add this line: 0 2 * * * /path/to/proxmox-full-backup.sh >> /var/log/proxmox-backup.log 2>&1
Critical Tip: Test Your Backups!
No backup is useful if you can't restore it. Every few weeks:
- Try restoring the host
config.dbon a test machine (or a fresh Proxmox install) to verify settings load correctly. - Restore a backup of a VM to ensure it boots and runs as expected.
备注:内容来源于stack exchange,提问作者mxcdh




