Proxmox VE Host Backup & Restore Guide#
This guide covers the automated backup and restoration process for all Proxmox VE nodes using the dedicated PVE-only scripts.
1. PVE Host Backup#
The proxmox_backup.sh script is designed to run exclusively on Proxmox VE hosts, creating a comprehensive backup of the node’s configuration and identity.
Prerequisites#
Before backups can run, the PVE node must have the primary NAS share mounted at /mnt/pve/Software. This is typically done via the Proxmox GUI (Datacenter > Storage > Add > SMB).
Automated Scheduling (Crontab)#
Add this line via crontab -e on each PVE node to run the backup daily at 7:00 PM.
0 19 * * * /bin/bash /mnt/pve/Software/Software/Scripts/Proxmox/proxmox_backup.sh > /dev/null 2>&1Manual Execution#
To trigger a backup immediately from any PVE node:
bash /mnt/pve/Software/Software/Scripts/Proxmox/proxmox_backup.sh2. PVE Host Restore#
The proxmox_restore.sh script orchestrates a full node recovery, but now relies on a pre-flight checklist to ensure the environment is prepared, significantly increasing reliability.
Manual Prerequisites for Restore#
The restore script is now a “smart checklist.” Before running it, you must complete these three manual steps:
- Hostname Match: Install the fresh Proxmox VE operating system using the exact same hostname as the original node (e.g.,
HP5). - Storage Provisioned: Using the Proxmox Web UI, navigate to
Datacenter -> HP5 -> Disks -> ZFSand create your ZFS storage pool with the correct name (e.g.,VMStorage). - Network Mounted: Add your NAS storage (
10.1.2.2) via the Proxmox UI and ensure it is mounted at/mnt/pve/Software.
The “One-Liner” Execution#
Once the prerequisites are met, launch the master script. It will ask you to confirm completion of the checklist before proceeding.
bash "/mnt/pve/Software/Software/Scripts/Proxmox/proxmox_restore.sh"Script Features Reference#
proxmox_backup.sh (v3.0)#
- PVE-Focused: All logic for detecting or running on a Proxmox Backup Server (PBS) has been removed. The script is now exclusively for PVE hosts.
- ZFS Blueprinting: Before creating the archive, the script now saves a complete blueprint of your storage layout (
lsblk,zpool status,zfs list) to asystem_info.txtfile inside the backup. This serves as a reference for manually recreating your ZFS pools during a restore. - Safer Exclusions: The script now explicitly excludes the
/etc/pve/privdirectory from the backup, preventing old SSL certificates and cluster keys from being archived. - Robust Logging: Correctly handles paths with spaces (like the old
PVE Backupsdirectory) to prevent “ambiguous redirect” errors. - Hardened Error Handling: The script’s
trapfunctions are now more robust, preventingunbound variableerrors if the script fails in its earliest stages. - Standardized Notifications: Uses a reliable, universal
sendmailcommand for notifications, removing dependencies on thepveshAPI which can be inconsistent after a restore.
proxmox_restore.sh (v6.2)#
- Pre-Flight Checklist: The script now starts with an interactive checklist, forcing the user to confirm that all manual prerequisites (hostname, storage, network) have been met before any action is taken. This is the most significant change for reliability.
- Removed Disk Automation: All fragile, complex code related to
fdisk,partprobe, andzpool createhas been completely removed from the script. - Surgical Brain Restore: The script no longer restores the entire
/etc/pvedirectory. It now surgically restores only the necessary configuration files, explicitly skipping the/etc/pve/privdirectory to avoid SSL certificate conflicts that cause the “white page” UI error. - Smart Fstab Update: The script no longer overwrites
/etc/fstab. It now intelligently reads the backup and appends only the network share (CIFS/NFS) lines to the existingfstab, preserving the boot drive’s correct UUID. - Automatic UI Repair: The script automatically runs
apt reinstall pve-managerandpvecm updatecerts --forceduring the restore process to proactively fix any potential UI file mismatches. - Intelligent Snapshot Filtering: When searching for PBS snapshots, the script now detects if the target is a VM or an LXC and specifically requests the correct snapshot type (
backup/vm/orbackup/ct/), preventingunexpected formaterrors when guest IDs have been reused. - Dynamic Storage Target: During the data restore (Phase 4), the script presents an interactive menu of all available storage pools, allowing the user to choose the correct destination for each VM/LXC, and overriding any incorrect storage targets from the backup file.
- Correct Command Syntax: All restore commands (
qmrestore,pct restore) now use the correct, validated argument order. - Idempotent & Re-runnable: Because it no longer manages disk partitions, the script is much safer to run multiple times if needed.
- Final Reboot Orchestration: The script ends with a clear
[Y/n]prompt to orchestrate the final reboot, ensuring all changes are applied cleanly.