Table of Contents


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:

::= <entry>*
::= <fs> (", <fs>)* : <spec>
::= /^.*$/
::= <gen_weekly> : <gen_daily> : <gen_hourly> <gen_weekly> ::= <generation>
::= <generation> <gen_hourly> ::= <generation> ("@ <hour> (", <hour>)*)? <generation> ::= /^[0-9]+$/
::= /^(0?[0-9]|1[0-9]|2[0-3])$/

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.


the periodic-snapshot utility is typically called via entries in the system default cron(8) table.

/etc/defaults/periodic.conf system registry containing variables that control the behaviour of periodic-snapshot.

this file contains local overrides for the default periodic-snapshot configuration.


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.[01]) and 1 daily (daily.0) generation of snapshots on the / and /usr filesystems, two daily (daily.[01]) and 4 hourly (hourly.[0123]) generations of snapshots on the /var filesystem, and 2 weekly (weekly.[01]), 6 daily (daily.[0123456]) and 8 hourly (hourly.[01234567]) 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.

See Also

sh(1) , crontab(5) , periodic.conf(5) , cron(8) , snapshot(8) ,


The periodic-snapshot utility first appeared in FreeBSD.


Ralf S. Engelschall <>

Table of Contents