gromox-snapshot

Name

gromox-snapshot — Helper to create btrfs snapshots of mailboxes

Synopsis

/usr/libexec/gromox/gromox-snapshot

Description

gromox-snapshot calls btrfs(8) to create snapshots of the current state of mailboxes as needed. gromox-snapshot is meant to be periodically invoked by a systemd timer (or, failing that, a classic cron job). The default interval of gromox-snapshot.timer is hourly.

The program generates snapshots "for this day" / "for this week" / etc., rather than snapshots which are at least one day / one week / etc. apart. When the snapshotter is run periodically, this evens out and is not a concern at all.

Options

The program has no command-line options.

Configuration file

/etc/gromox/snapshot.cfg will be read on startup. It is a trivial key=value file, with one variable per line.

retention_days=n
Make daily snapshots and keep them for n days. Use 0 to deactivate daily snapshots.
Default: 7
retention_hours=n
Make monthly snapshots and keep them for n months. Use 0 to deactivate monthly snapshots.
Default: 0
retention_months=n
Make monthly snapshots and keep them for n months (more precisely, n*31 days). Use 0 to deactivate monthly snapshots.
Default: 0
retention_weeks=n
Make weekly snapshots and keep them for n weeks. Use 0 to deactivate weekly snapshots.
Default: 4
subvolume_root
Specifies the root directory of the nearest btrfs subvolume. (As of Linux 6.2.1, it is not possible to snapshot arbitrary directories; it has to be the root of a subvolume. Confer with `btrfs sub list` to see subvolumes.)
Default: /var/lib/gromox
snapshot_archive
The directory where snapshots (these are subdirectories) will be placed. This directory needs to be on the same btrfs device as the snapshot source (subvolume_root, see above).
Default: /var/lib/gromox-snapshots

Each time "category" (days, weeks, etc.) is independently evaluated and snapshots are always made from the subvolume_root, never from another snapshot. A weekly snapshot generated on the first day of the week is not strictly equal to the daily snapshot generated for the same day, as there is technically a very small time window between individual btrfs commands.

See also

gromox(7)