zfs-snap

zfs-snap periodically creates and deletes ZFS snapshots on a FreeBSD machine.

Installation

  1. Download 598.zfs-snap
  2. Move it to /usr/local/etc/periodic/daily or /usr/local/etc/periodic/weekly
  3. Make it executable

Configuration

At least, add the following lines to /etc/periodic.conf:

zfs_snap_enable="YES"
zfs_snap_filesystems="zroot/usr zroot/home:3m"
Every time zfs-snap is executed, it'll create a snapshot of zroot/usr and zroot/home. Snapshots are named like zroot/usr@zs20161227-123242, i.e. current date and time. Snapshots created by zfs-snap will be kept for 1 month (the default) on zroot/usr, but will be kept for 3 months on zroot/home. You can specify any time adjustment which is accepted by date (see option -v). To override the default time period for which snapshots are kept, add this to /etc/periodic.conf:
zfs_snap_keep="6w"
Every snapshot will be kept for 6 weeks unless overridden by some entry within zfs_snap_filesystems.