snapraid-sync — guard, precheck, then write parity¶
Nightly at 03:30 the timer starts the unit; the unit runs the guard, which runs the precheck, and only then snapraid sync. A failed precheck is a failed unit and pages ntfy.
Input → Movement → Output¶
Reads the three data disks and the content files. Recomputes parity for changed blocks (deleted blocks are flagged and recomputed too — a big exclusion rewrites hundreds of GB). Writes parity, then the content file to all four locations; autosave 100 checkpoints every 100 GB.
Why this shape¶
The one destructive failure mode of offline parity is syncing against a missing or mass-deleted disk: the loss becomes the new truth. The precheck refuses to sync when a mount is missing or read-only, SMART is unhealthy, the kernel logged I/O errors in 6 h, or snapraid diff shows > 500 removed / > 2,000 updated files.
Steps¶
snapraid-sync.timer→snapraid-sync.service; ExecStart overridden to/usr/local/bin/snapraid-sync-guard.sh(snapraid-sync.service.d/override.conf).- Guard runs
/home/angel/snapraid-precheck.sh(snapraid-sync-guard.sh:4-10); on failurelogger+ exit 1 →OnFailure=snapraid-alert@%n(.d/alert.conf). - Precheck: mounts rw (
:7-12) → SMART health + pending/offline on sda–sdd, skipping a drive in standby (smartctl -n standby, added 09-09 so a no-op night does not leave parity spinning) → kernel I/O errors (:37-39) →snapraid status(:41) →snapraid diffthresholdsDEL_LIMIT=500 UPD_LIMIT=2000(:48-59, overridable via env for a known large change). exec /usr/bin/snapraid -l /var/log/snapraid/sync-%D.log sync(snapraid-sync-guard.sh:12).
Manual: sr (runs the unit, blocks, reports). For a known large change: sudo DEL_LIMIT=N /home/angel/snapraid-precheck.sh to see the numbers, then run the sync by hand with -l as item 06 did.
If you change this¶
- Hits: the alert path (unit name is in
OnFailure) · the rescue kit copies both scripts nightly (rescue-sync.sh:112) · scrub runs at Sun 04:00 and expects a synced array. - Does not hit: mergerfs, containers (sync reads through
/mnt/diskN, isNice=10+ idle I/O class).
Surfaces¶
| Surface | Role |
|---|---|
ntfy plex-hgviaey |
failure only |
/var/log/snapraid/ |
per-run logs |
journalctl -u snapraid-sync |
precheck messages |
See¶
- Objects: snapraid-array
- Source:
systemctl cat snapraid-sync.service·/usr/local/bin/snapraid-sync-guard.sh·/home/angel/snapraid-precheck.sh