automatic backups of a ZFS filesystem

Today I removed accidentally a file on my laptop on a ZFS filesystem. I had a backup on an external disk, but to not trap into that again, I installed now
the ZFS autosnapshot tool from Tim Foster.

I used this valuable tool already on some servers running Solaris 10 on SPARC
hardware.

After downloading you have to extract the archive and call "make"

This generates in the proto subdirectory the package TIMFaut-snapshot.

ewer@solewer:/tmp/zfs-auto-snapshot-0.10/proto$ pfexec pkgadd -d .

The following packages are available:
1 TIMFauto-snapshot ZFS Automatic Snapshot Service
(all) 0.10

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 1

Now you can use a graphical gui and set the backup interval:

/usr/bin/zfs-auto-snapshot-admin.sh simple

















You can view your setting also direct in the properties of the ZFS filesystem:

ewer@solewer:/tmp$ zfs get all rpool/export/home
...
rpool/export/home com.sun:auto-snapshot:frequent true local
rpool/export/home com.sun:auto-snapshot:daily false local

Parametrization of the Snapshot ( how many snapshots, how often, .... ) can be
done with svccfg:

ewer@solewer:/tmp$ svccfg
svc:> select auto-snapshot:daily
svc:/system/filesystem/zfs/auto-snapshot:daily> listprop
start method
start/exec astring "/lib/svc/method/zfs-auto-snapshot start"
start/timeout_seconds count 0
start/type astring method
stop method
stop/exec astring "/lib/svc/method/zfs-auto-snapshot stop"
stop/timeout_seconds count 0
stop/type astring method
startd framework
startd/duration astring transient
zfs application
zfs/backup astring none
zfs/backup-lock astring unlocked
zfs/backup-save-cmd astring "not set"
zfs/fs-name astring //
zfs/interval astring days
zfs/label astring daily
zfs/offset astring 0
zfs/period astring 1
zfs/snapshot-children boolean false
zfs/verbose boolean false
zfs/keep astring 14
general framework
general/enabled boolean true
restarter framework NONPERSISTENT
restarter/logfile astring /var/svc/log/system-filesystem-zfs-auto-snapshot:daily.log
restarter/start_pid count 18063
restarter/start_method_timestamp time 1223549190.558374000
restarter/start_method_waitstatus integer 0
restarter/transient_contract count
restarter/auxiliary_state astring none
restarter/next_state astring none
restarter/state astring online
restarter/state_timestamp time 1223549190.566421000
restarter_actions framework NONPERSISTENT
restarter_actions/refresh integer
svc:/system/filesystem/zfs/auto-snapshot:daily>
Here for example I have modified zfs/keep to 14 days instead of the default of 31 days.

Many Thanks to Tim Foster for this superb tool.