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>&1

Manual Execution#

To trigger a backup immediately from any PVE node:

bash /mnt/pve/Software/Software/Scripts/Proxmox/proxmox_backup.sh

2. 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:

  1. Hostname Match: Install the fresh Proxmox VE operating system using the exact same hostname as the original node (e.g., HP5).
  2. Storage Provisioned: Using the Proxmox Web UI, navigate to Datacenter -> HP5 -> Disks -> ZFS and create your ZFS storage pool with the correct name (e.g., VMStorage).
  3. 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)#

  1. 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.
  2. ZFS Blueprinting: Before creating the archive, the script now saves a complete blueprint of your storage layout (lsblk, zpool status, zfs list) to a system_info.txt file inside the backup. This serves as a reference for manually recreating your ZFS pools during a restore.
  3. Safer Exclusions: The script now explicitly excludes the /etc/pve/priv directory from the backup, preventing old SSL certificates and cluster keys from being archived.
  4. Robust Logging: Correctly handles paths with spaces (like the old PVE Backups directory) to prevent “ambiguous redirect” errors.
  5. Hardened Error Handling: The script’s trap functions are now more robust, preventing unbound variable errors if the script fails in its earliest stages.
  6. Standardized Notifications: Uses a reliable, universal sendmail command for notifications, removing dependencies on the pvesh API which can be inconsistent after a restore.

proxmox_restore.sh (v6.2)#

  1. 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.
  2. Removed Disk Automation: All fragile, complex code related to fdisk, partprobe, and zpool create has been completely removed from the script.
  3. Surgical Brain Restore: The script no longer restores the entire /etc/pve directory. It now surgically restores only the necessary configuration files, explicitly skipping the /etc/pve/priv directory to avoid SSL certificate conflicts that cause the “white page” UI error.
  4. 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 existing fstab, preserving the boot drive’s correct UUID.
  5. Automatic UI Repair: The script automatically runs apt reinstall pve-manager and pvecm updatecerts --force during the restore process to proactively fix any potential UI file mismatches.
  6. 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/ or backup/ct/), preventing unexpected format errors when guest IDs have been reused.
  7. 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.
  8. Correct Command Syntax: All restore commands (qmrestore, pct restore) now use the correct, validated argument order.
  9. Idempotent & Re-runnable: Because it no longer manages disk partitions, the script is much safer to run multiple times if needed.
  10. Final Reboot Orchestration: The script ends with a clear [Y/n] prompt to orchestrate the final reboot, ensuring all changes are applied cleanly.