Skip to content

Shell script to manage ZFS snapshots and send/recv

License

Notifications You must be signed in to change notification settings

riiengineering/zfs-snapsend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

zfs-snapsend

A simple, POSIX shell script to manage automatic ZFS snapshots and syncing of these to other zpools or remote systems (send/recv).

Installation

Download the zfs-snapsend script from this repository and install it to a directory of your choice (e.g. /usr/local/sbin) or into /etc/cron.hourly for automatic cron job configuration.

curl -O /usr/local/sbin/zfs-snapsend https://github.com/riiengineering/zfs-snapsend/raw/main/zfs-snapsend
chown 0:0 /usr/local/sbin/zfs-snapsend
chmod 0750 /usr/local/sbin/zfs-snapsend

Usage

The configuration of zfs-snapsend works by setting ZFS properties on the datasets you wish to have snapshotted or synced. All properties are applied recursively to child datasets, too.

Supported properties:

ch.riiengineering:auto-snapshot = never|hourly|daily|weekly|monthly|yearly

How often to create a fresh snapshot.

NOTE: Snapshots have a hysteresis of 30 minutes.

NOTE: This script must be run with a higher frequency than the most frequent auto-snapshot.

ch.riiengineering:auto-snapshots-keep = all|n>0

Either keep all or the last n snapshots.

ch.riiengineering:auto-sync-to = [[user@]host:]pool[/dataset]

Sync (all) snapshots of this dataset to another zpool (either local or to a remote system via SSH).

Only snapshots created since the last sync are added on the target, i.e. snapshots deleted on the remote system will not be restored unless they were the latest one(s).

For syncing to a remote system, the ssh_config files are respected and the zfs binary in the default PATH is used.


riiengineered.

About

Shell script to manage ZFS snapshots and send/recv

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages