Automatic ZFS snapshots on Solaris 11
Solaris 11 has a built-in mechanism to take hourly/daily/weekly snapshots of your ZFS datasets, e.g. rpool/export/home. The service is called "time-slider", which can integrate with a nice GUI (which I don't have installed.
Older snapshots are automatically deleted either when space is too tight, or they are more than X snapshots old (e.g. by default four weekly snapshots are kept, see the svccfg properties below).
The oracle documentation is not very useful, however.
In short, the required steps are:
# pkg install time-slider
# svcadm restart dbus
# svcadm enable time-slider
`</pre>
We need to specify which datasets will be enabled -- for example our home directories:
<pre>`zfs set com.sun:auto-snapshot=true rpool/export/home
`</pre>
Once we enable time-slider, it will create some auto-snapshot services -- frequent, daily, hourly and weekly. We enable them with:
<pre>`# svcadm enable auto-snapshot:frequent
# svcadm enable auto-snapshot:hourly
# svcadm enable auto-snapshot:daily
# svcadm enable auto-snapshot:weekly
`</pre>
It seems that when we install time-slider, it adds some dbus configuration which necessitates the dbus restart above -- otherwise the time-slider service will fail to come online due to a dbus permission error.
We can tweak the configuration of each service using service properties -- view with listprop, edit with editprop:
<pre>`# svccfg -s auto-snapshot:frequent listprop zfs
zfs application
zfs/interval astring minutes
zfs/keep astring 3
zfs/period astring 15