Snapshot backup host, prune and compact system backups #216

Open
fabianhauser wants to merge 5 commits from backup-snapshots into main
Owner

Backup clients keep full borg access and now prune (within=14d, weekly=4, monthly=6, yearly=-1, as lindberg data-local) and compact after each backup. As a layer the clients can't reach, the backup host keeps weekly read-only snapper snapshots of the backup root for 31 days.

PeriodicJobNotSucceeded now compares the last success with the job timer's gap between its last and next trigger (+6h) instead of a fixed 30h. Prometheus retention is raised to 31d to back the lookback.

Migration on cyprianspitz (before deploy)

These commands produce the same layout disko creates (/backup and /backup/.snapshots as plain btrfs subvolume create below the top-level volume). Run them while no client backup is running (clients start at 07:06):

pgrep -u borg -a borg                         # must print nothing
btrfs subvolume show /mnt/data/backup         # expected to fail: still a plain directory
mv /mnt/data/backup /mnt/data/backup.old
btrfs subvolume create /mnt/data/backup
btrfs subvolume create /mnt/data/backup/.snapshots
cp -a --reflink=always /mnt/data/backup.old/. /mnt/data/backup/
rm -rf /mnt/data/backup.old

After deploy, tmpfiles sets .snapshots to 0750 root:root.

Checklist

  • migration ran before deploy; btrfs subvolume list /mnt/data shows backup and backup/.snapshots
  • systemctl list-timers snapper-timeline shows the next run; after it, snapper -c backup list shows a snapshot and btrfs property get -ts /mnt/data/backup/.snapshots/<n>/snapshot ro is ro=true
  • client borgbackup-job-system-* runs succeed with prune + compact
  • systemd_job_next_execution_gap_seconds is visible in Prometheus for all periodic jobs, and no spurious PeriodicJobNotSucceeded fires
Backup clients keep full borg access and now prune (`within=14d, weekly=4, monthly=6, yearly=-1`, as lindberg `data-local`) and compact after each backup. As a layer the clients can't reach, the backup host keeps weekly read-only snapper snapshots of the backup root for 31 days. `PeriodicJobNotSucceeded` now compares the last success with the job timer's gap between its last and next trigger (+6h) instead of a fixed 30h. Prometheus retention is raised to 31d to back the lookback. ## Migration on cyprianspitz (before deploy) These commands produce the same layout disko creates (`/backup` and `/backup/.snapshots` as plain `btrfs subvolume create` below the top-level volume). Run them while no client backup is running (clients start at 07:06): ```bash pgrep -u borg -a borg # must print nothing btrfs subvolume show /mnt/data/backup # expected to fail: still a plain directory mv /mnt/data/backup /mnt/data/backup.old btrfs subvolume create /mnt/data/backup btrfs subvolume create /mnt/data/backup/.snapshots cp -a --reflink=always /mnt/data/backup.old/. /mnt/data/backup/ rm -rf /mnt/data/backup.old ``` After deploy, tmpfiles sets `.snapshots` to `0750 root:root`. ## Checklist - [ ] migration ran before deploy; `btrfs subvolume list /mnt/data` shows `backup` and `backup/.snapshots` - [ ] `systemctl list-timers snapper-timeline` shows the next run; after it, `snapper -c backup list` shows a snapshot and `btrfs property get -ts /mnt/data/backup/.snapshots/<n>/snapshot ro` is `ro=true` - [ ] client `borgbackup-job-system-*` runs succeed with prune + compact - [ ] `systemd_job_next_execution_gap_seconds` is visible in Prometheus for all periodic jobs, and no spurious `PeriodicJobNotSucceeded` fires
Prune and compact system backups
All checks were successful
CI / build (push) Successful in 13m26s
CI / deploy (docs-ops.qo.is) (push) Has been skipped
CI / deploy (system-physical) (push) Has been skipped
CI / deploy (system-vm) (push) Has been skipped
CI / deploy-ci (push) Has been skipped
b4eb8b1d53
fabianhauser force-pushed backup-snapshots from b4eb8b1d53
All checks were successful
CI / build (push) Successful in 13m26s
CI / deploy (docs-ops.qo.is) (push) Has been skipped
CI / deploy (system-physical) (push) Has been skipped
CI / deploy (system-vm) (push) Has been skipped
CI / deploy-ci (push) Has been skipped
to ff96fb342a
All checks were successful
CI / build (push) Successful in 4m51s
CI / deploy (docs-ops.qo.is) (push) Has been skipped
CI / deploy (system-physical) (push) Has been skipped
CI / deploy (system-vm) (push) Has been skipped
CI / deploy-ci (push) Has been skipped
2026-11-02 16:25:28 +00:00
Compare
All checks were successful
CI / build (push) Successful in 4m51s
CI / deploy (docs-ops.qo.is) (push) Has been skipped
CI / deploy (system-physical) (push) Has been skipped
CI / deploy (system-vm) (push) Has been skipped
CI / deploy-ci (push) Has been skipped
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'backup-snapshots:backup-snapshots'
git switch 'backup-snapshots'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
qo.is/infrastructure!216
No description provided.