Effortless ZFS Snapshot Automation in Proxmox

ZFS and the Need for Automated Snapshots

Before diving into the specifics of ZFS Autobackup, it’s essential to understand the significance of ZFS in modern data storage solutions. ZFS is a file system and logical volume manager originally designed by Sun Microsystems. It provides high storage capacities, advanced data protection features, and is widely used in environments where data integrity and reliability are paramount.

However, despite ZFS’s robustness, regular backups are crucial. Backups provide an additional layer of security, ensuring that data can be recovered in case of catastrophic failures, ransomware attacks, or user errors. Manual backups, though effective, can be cumbersome and prone to human error. This is where automated tools like ZFS Autobackup come into play.

ZFS Autobackup stands out for its simplicity and reliability in automating the backup process. This tool, available on GitHub, is designed to periodically backup ZFS filesystems to other locations, ensuring data safety and resilience against hardware failures, accidental deletions, and other data loss scenarios.

Guide for Installing and Using zfs_autobackup in Proxmox

zfs_autobackup is a tool that automates the backup of ZFS datasets. It supports remote replication, incremental backups, and easy restoration. This guide will walk you through the installation and usage of zfs_autobackup on a Proxmox environment.

Prerequisites

  • A Proxmox server with ZFS installed.
  • Basic familiarity with command-line operations.
  • Access to a remote server for backup (optional).

Step 1: Install Dependencies

First, ensure your Proxmox system is up-to-date and that the necessary dependencies are installed.

apt update && apt upgrade -y
apt install python3-pip git

Step 2: Install zfs_autobackup

pip install --upgrade zfs-autobackup

Verify the installation by running:

zfs_autobackup --version

Step 3: Preparing your Proxmox Cluster

The cluster’s rpool/data can be distributed across multiple nodes, with each filesystem having a unique identifier throughout the entire cluster. This unique naming convention suggests that we should consolidate the backups of rpool/data from all nodes into a single destination. This approach prevents redundant backups of replicated filesystems.

The flexibility of the system allows for host migration without disrupting the backup process. In fact, zfs-autobackup is designed to adapt seamlessly, automatically retrieving the next backup from the new node after migration.

There is no much to prepare, in this documentation example you will find a script that does what you are looking for: Proxmox Script

Take in consideration that from the Backup server you need access using ssh, generating those keys with ssh-keygen and coping them across to your nodes is a must, in the link there is a .ssh/config file that helps in the process, remember to change your ports to 22 which is the default for ssh.

Also the script takes care of relaying the backup status to Zabbix, so if you are not using Zabbix feel free to comment or remove any line that begins with: zabbix-job-status