ZFS autobackup

Written by Kirill Filatov, on 25 October 2026.
Tags: #freebsd #bsd #zfs

ZFS-autobackup cheatsheet

Intro

ZFS-autobackup is a Python script for managing zfs snapshots. The main idea is simple and elegant. Label datasets you want to backup and the tool handles the rest - take snapshot, copy it to desired location and clean up when needed.

Common usage flow

# recursively label desired pool

zfs set autobackup:offsite1=true <pool> # set to false for excluding subvols

# check labeled sets

zfs get -t filesystem,volume autobackup:offsite1

# remove label completely

zfs inherit autobackup:offsite1 <pool>

# run backup

zfs-autobackup -v --clear-mountpoint --progress --ssh-target <dst_host> offsite1 <zroot/backup>

# or pull backup from another host # omit backup set for snapshoting only

zfs-autobackup -v --clear-mountpoint --progress --ssh-source <src_host> offsite1 <zroot/backup>

Restore

zfs send <zroot/backup/set> | ssh <host> "zfs recv <pool/restore>"

Command line options

ZFS-autobackup doesn’t have config file, so all options are set via command line.

You can see all available options with –help.

  • -n – dry-run

  • -d – debug, show zfs commands that will be executed

  • –keep-source|target – retention policy # has reasonable default