offsite-sync-backup + nfs-change-tracker: exclude /srv/nfs/anca-elements
Some checks failed
ci/woodpecker/push/build-cli Pipeline failed
ci/woodpecker/push/default Pipeline was successful

The 771G under /srv/nfs/anca-elements is a downstream replica synced
FROM Synology (/volume1/Backup/Anca/Elements) by anca-elements-sync.sh.
The offsite-sync pipeline was copying it back to Synology under
/volume1/Backup/Viki/nfs/anca-elements, creating a self-duplicate
(~122G already partially copied during the last monthly full sync).

- nfs-change-tracker.service: drop anca-elements/ from inotify watch
  (incremental syncs no longer queue these paths)
- offsite-sync-backup.sh: --exclude='anca-elements/' on the monthly
  full rsync; grep -v on the incremental files-from list

Deployed to 192.168.1.127:/usr/local/bin/offsite-sync-backup +
/etc/systemd/system/nfs-change-tracker.service; service reloaded.
This commit is contained in:
Viktor Barzin 2026-05-24 11:03:09 +00:00
parent 41786b0fca
commit 05f047f290
2 changed files with 6 additions and 3 deletions

View file

@ -7,7 +7,7 @@ Type=simple
ExecStart=/usr/bin/inotifywait -m -r \
--format '%%w%%f' \
-e create -e modify -e moved_to -e delete \
--exclude '(/\..*swp$|/\.nfs|/\.Trash|\.db-shm$|\.db-wal$|\.db-journal$|/stats/.*\.stat$)' \
--exclude '(/\..*swp$|/\.nfs|/\.Trash|\.db-shm$|\.db-wal$|\.db-journal$|/stats/.*\.stat$|^/srv/nfs/anca-elements/)' \
/srv/nfs \
/srv/nfs-ssd
StandardOutput=append:/mnt/backup/.nfs-changes.log

View file

@ -78,8 +78,10 @@ log "--- Step 2: NFS → Synology (change-tracked) ---"
if [ "${DAY_OF_MONTH}" -le 7 ]; then
# Monthly: full sync with --delete for cleanup
# anca-elements/ is excluded — source of truth is Synology /volume1/Backup/Anca/Elements;
# the PVE copy is a downstream replica, syncing it back would just duplicate ~770G.
log "Monthly full NFS sync..."
rsync -rltz --delete /srv/nfs/ "${NFS_DEST}/" 2>&1 \
rsync -rltz --delete --exclude='anca-elements/' /srv/nfs/ "${NFS_DEST}/" 2>&1 \
&& log " OK: nfs/ full sync" || { warn "nfs/ full sync failed"; STATUS=1; }
rsync -rltz --delete /srv/nfs-ssd/ "${NFS_SSD_DEST}/" 2>&1 \
&& log " OK: nfs-ssd/ full sync" || { warn "nfs-ssd/ full sync failed"; STATUS=1; }
@ -88,8 +90,9 @@ elif [ -s "${NFS_CHANGE_LOG}" ]; then
# Incremental: only sync files logged by inotifywait
sort -u "${NFS_CHANGE_LOG}" > /tmp/nfs-changes-deduped
# HDD NFS
# HDD NFS — drop anca-elements/* paths (excluded from offsite; see Monthly block)
grep '^/srv/nfs/' /tmp/nfs-changes-deduped | \
grep -v '^/srv/nfs/anca-elements/' | \
while IFS= read -r f; do [ -f "$f" ] && echo "${f#/srv/nfs/}"; done \
> /tmp/sync-nfs.list 2>/dev/null
NFS_COUNT=$(wc -l < /tmp/sync-nfs.list 2>/dev/null || echo 0)