diff --git a/INSTALL.md b/INSTALL.md index 9b227d5..5aa3c3e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -171,6 +171,17 @@ pkg install p5-Config-Inifiles p5-Capture-Tiny pv mbuffer lzop 3. Create the config directory `/etc/sanoid` and put `sanoid.defaults.conf` in there, and create `sanoid.conf` in it too 4. Create a cron job or a systemd timer that runs `sanoid --cron` once per minute +## cron + +If you use cron there is the need to ensure that only one instance of sanoid is run at any time (or else there will be funny error messages about missing snapshots, ...). It's also good practice to separate the snapshot taking and pruning so the later won't block the former in case of long running pruning operations. Following is the recommend setup for a standard install: + +``` +*/15 * * * * root flock -n /var/run/sanoid/cron-take.lock -c "TZ=UTC sanoid --take-snapshots" +*/15 * * * * root flock -n /var/run/sanoid/cron-prune.lock -c "sanoid --prune-snapshots" +``` + +Adapt the timer interval to the lowest configured snapshot interval. + # Configuration **Sanoid** won't do anything useful unless you tell it how to handle your ZFS datasets in `/etc/sanoid/sanoid.conf`. diff --git a/README.md b/README.md index 89ddd4a..a7903dc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

sanoid rollback demo
(Real time demo: rolling back a full-scale cryptomalware infection in seconds!)

-More prosaically, you can use Sanoid to create, automatically thin, and monitor snapshots and pool health from a single eminently human-readable TOML config file at /etc/sanoid/sanoid.conf. (Sanoid also requires a "defaults" file located at /etc/sanoid/sanoid.defaults.conf, which is not user-editable.) A typical Sanoid system would have a single cron job: +More prosaically, you can use Sanoid to create, automatically thin, and monitor snapshots and pool health from a single eminently human-readable TOML config file at /etc/sanoid/sanoid.conf. (Sanoid also requires a "defaults" file located at /etc/sanoid/sanoid.defaults.conf, which is not user-editable.) A typical Sanoid system would have a single cron job but see INSTALL.md fore more details: ``` * * * * * TZ=UTC /usr/local/bin/sanoid --cron ```