periodic-snapshot -- run periodic UFS/ZFS backup snapshot maintenance task
The periodic-snapshot utility is intended to be called by cron(8) to create and expire UFS/ZFS backup snapshots through the snapshot(8) command according to the snapshot_enable and snapshot_schedule settings from periodic.conf(5) .
The system /etc/crontab will typically have entries for periodic-snapshot similar to the following example:
# do hourly/daily/weekly maintenance of FreeBSD UFS/ZFS snapshots 0 * * * * root periodic-snapshot hourly 0 0 * * * root periodic-snapshot daily 0 0 * * 0 root periodic-snapshot weekly
The /etc/defaults/periodic.conf system registry will typically contain the following defaults which keep periodic-snapshot disabled by default:
The snapshot_schedule variable values have to conform to the following grammar:
The number of all added generation numbers of a filesystem cannot be larger than 20 because this is the maximum number of snapshots which can be created on a UFS/ZFS filesystem. A generation number of 0 disables the creation of backup snapshots.
The used schedule heavily depends on how much generations of snapshots should be kept, which in turn depends on how much disk space is available.
/etc/defaults/periodic.conf system registry containing variables that control the behaviour of periodic-snapshot.
In order to configure UFS/ZFS backup snapshot creation, add lines to /etc/periodic.conf similar to:
snapshot_schedule="/,/usr:2:1:0 /var:0:2:4 /home:2:6:8@8,12,16,20"
This schedules the following UFS/ZFS backup snapshots: 2 weekly (weekly.) and 1 daily (daily.0) generation of snapshots on the / and /usr filesystems, two daily (daily.) and 4 hourly (hourly.) generations of snapshots on the /var filesystem, and 2 weekly (weekly.), 6 daily (daily.) and 8 hourly (hourly.) generations of snapshots on the /home filesystem. While the hourly snapshots on /var are created every hour, the hourly snapshots on /home are created on 08:00, 12:00, 16:00 and 20:00 only.
sh(1) , crontab(5) , periodic.conf(5) , cron(8) , snapshot(8) , http://people.freebsd.org/~rse/snapshot/.
The periodic-snapshot utility first appeared in FreeBSD.
Ralf S. Engelschall <rse@FreeBSD.org>
Table of Contents