|45 Drives Knowledge Base
||KB450410 - Automated ZFS Snapshots and Replication
This article will walk through the process of installing and configuring automated zfs snapshots and replication.
The following process works with Ubuntu20.04, CentOS7 and CentOS8.
The tool used to achieve automated snapshots and replication is a open source project called "znapzend". Its description from the github readme:
ZnapZend is a ZFS centric backup tool to create snapshots and send them to backup locations. It relies on the ZFS tools snapshot, send and receive to do its work. It has the built-in ability to manage both local snapshots as well as remote copies by thinning them out as time progresses.
The ZnapZend configuration is stored as properties in the ZFS filesystem itself.
apt purge zfs-auto-snapshot -y
apt install znapzend -y
yum remove zfs-auto-snapshot -y
yum install epel-release -y
yum install znapzend -y
dnf remove zfs-auto-snapshot -y
dnf install epel-release -y
dnf install dnf-plugins-core -y yum config-manager --set-enabled powertools
dnf install znapzend -y
Configuring znapzend is the same process on Ubnutu20.04LTS,CentOS7 and CentOS8.
Configuring znapzend is the same process on Ubnutu20.04LTS,CentOS7 and CentOS8
ssh-keygen (You'll be prompted with 3 questions, just press enter on all 3 until you're returned to the command prompt) ssh-copy-id root@hostname1 (You will be asked if you want to continue connecting, say "yes" and then enter the root password.) ssh-copy-id root@hostname2
This example will create an automated snapshot task on a local zpool. Snapshots will be created and destroyed based on the schedule and lifetime explained below.
znapzendzetup create --recursive SRC '7d=>1h,30d=>4h,90d=>1d' tank/dataset1
This example will create an automated backup task on a local zpool (Source, SRC) and send to a remote zpool (Destination, DST).
Snapshots on the SRC will be created and sent to the backup DST and then removed as per the lifetime plan.
znapzendzetup create --recursive --mbuffer=/usr/bin/mbuffer --mbuffersize=1G SRC '7d=>1h,30d=>4h,90d=>1d' tank/dataset1 DST:a '7d=>1h,30d=>4h,90d=>1d' email@example.com:tank/dataset1
Backup config in case complete loss of pool in the future.
znapzendzetup export tank/dataset1 ~/znapzend-tank-dataset1.backup
Both intervals and retention periods are expressed in standard units of time or multiples of them. You can use both the full name or a shortcut according to the following table:
In the event of complete failure of the main storage pool. Follow this guide on recovering from backup dataset