Written by: Robert R. Russell on Tuesday, August 4, 2020.
I haven’t seen a lot of tools that are designed to backup ZFS snapshots to removable media. So, I am writing my own. I am going to document the process here.
The basic loop for a backup tool is
I am designing this tool to only backup snapshots taken by zfs-auto-snapshot.
These are named
<pool|filesystem>@zfs-auto-snap_<time interval>-<year>-<month>-<day>-<hour><minute>
.
The command zfs -Hrt snapshot <source poolname>
will generate a list of
all snapshots in a pool in a machine parseable format.
Issuing the command zfs send -ci <old snapshot> <pool|filesystem>@<new snapshot>
will send an incremental snapshot from old to new to the commands standard
output. I can estimate the amount of data to be transferred by replacing
-ci
with -cpvni
in the zfs send command.
Issuing the command zfs receive -u <backup location>
will store a snapshot
from its standard input to the backup location.
Snapshots are removed by zfs destroy -d <pool|filesystem>@<snapshot name>
.
The snapshot name is the portion of the snapshot pattern mentioned above after
the @ symbol.
©2020 Robert R. Russell — All rights reserved