Page MenuHomeDevCentral

ZFS snapshots on devserver
Closed, ResolvedPublic

Description

Snapshots should be allow to easily go back in time.

As such, the following is offered by Solaris/OpenIndiana Time Slider:

NameSnapshot everyHow many we kept?
frequent15 mins4 (=one hour)
hourlyhour24 (=one day)
dailyday31 (=one month)
weeklyweek7 (=two months)
monthlymonth12 (=a year)

It would be a nice idea to implement this on Ysul.

References:

Related Objects

StatusSubtypeAssignedTask
Resolveddereckson
Resolveddereckson

Event Timeline

dereckson renamed this task from ZFS snapshots on Ysul to ZFS snapshots on devserver.Mar 24 2023, 00:17
dereckson triaged this task as High priority.Mar 24 2023, 00:29

⚠ It's been experimentally manually configured on WindRiver through zfs-auto-snapshot.

New timetable

NameSnapshot everyHow many we kept?WindRiver config
frequent15 mins4 (=one hour)24 but each 5 minutes (=2 hours)
hourlyhour24 (=one day)48 (=2 days)
dailyday31 (=one month)14 (=1/2 month)
weeklyweek7 (=two months)4 (= 1 month)
monthlymonth12 (=a year)>>

Steps

We've so a drift between config and installed version.

It seems 3 things are needed:

  1. Install zfs-auto-snapshot package
  2. Create /etc/cron.d/zfs file
  3. Apply to the home/<user> volumes com.sun:auto-snapshot=true
/etc/cron.d/zfs
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

# See crontab(5) for field format.
*/5 * * * * root /usr/local/sbin/zfs-auto-snapshot frequent 24
0   * * * * root /usr/local/sbin/zfs-auto-snapshot hourly   48
7   0 * * * root /usr/local/sbin/zfs-auto-snapshot daily    14
14  0 * * 7 root /usr/local/sbin/zfs-auto-snapshot weekly    4
28  0 1 * * root /usr/local/sbin/zfs-auto-snapshot monthly  12
Set ZFS property
$ zfs list | grep /usr/home/ | awk '{print "sudo zfs set com.sun:auto-snapshot=true " $1}' | sh