Backup Proxmox (single node, but including VM's!) with sanoid/syncoid on a schedule

Backup Proxmox (single node, but including VM's!) with sanoid/syncoid on a schedule

First of all, I only use a one node Proxmox server meaning all my data is in a single pool. If you use multiple nodes this is probably more complex...

I already backup my Ubuntu computer running ZFS using sanoid/syncoid so the most efficient way for me to back up Proxmox is just repeat that behavior.

GitHub - jimsalterjrs/sanoid: Policy-driven snapshot management and replication tools. Using ZFS for underlying next-gen storage. (Btrfs support plans are shelved unless and until btrfs becomes reliable.) Primarily intended for Linux, but BSD use is supported and reasonably frequently tested.
Policy-driven snapshot management and replication tools. Using ZFS for underlying next-gen storage. (Btrfs support plans are shelved unless and until btrfs becomes reliable.) Primarily intended fo...

Follow the installation instructions from the Github Repo, and configure your backup schedule in /etc/sanoid/sanoid.conf.  The config sets up how frequently snapshots run and how long they're preserved. For example, by default, hourly snapshots are only kept for 48 hours.

[rpool]
        use_template = production
        recursive=yes

[template_production]
        frequently = 0
        hourly = 36
        daily = 30
        monthly = 3
        yearly = 0
        autosnap = yes
        autoprune = yes

/etc/sanoid/sanoid.conf

Once configured, just schedule a cronjob with root to sync the backup to your backup server (e.g., TrueNAS/FreeNAS).

switch to root sudo su then run crontab -e and add the following line.

5  * * * * /usr/sbin/syncoid --no-sync-snap --recursive  --no-privilege-elevation --sshkey=~/.ssh/key-nas  --exclude=swap rpool username@192.168.1.9:nas/LiveBackups/proxmox/rpool

By syncing rpool recursively we back up the Proxmox installation as well as all VM's / containers stored on that pool. For a multiple node set up you'd need to find a way to back up multiple pools from multiple machines. There might be a way from Proxmox snapshots but I'm not sure the best way!