Repository navigation
fix(backups): keep every backup of the last week, so as-of restores find them - #65
Merged
Merged
Conversation
…ind them restic's forget kept only the newest backup of each day. A --new-cluster rebuild backs up, then the new cluster backs up its fresh volumes the same day: that backup's forget deleted the rebuild's, and restore-all --as-of silently restored an older snapshot (on a live cluster, Pi-hole and WireGuard came back as they were a day earlier, freshly installed). The default per-app retention now also keeps everything within 7 days. vm-app-backups gets the scenario: two backups the same day, a restore as of the first must return the first (without the fix it returns an older one). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by the unattended
--new-clusterrebuild on v1.24.2. It finished by itself, Longhorn's first sync included, but Pi-hole and WireGuard came back in an older state.Why:
restic forget, withkeep-daily, keeps only the newest backup of each day, so it deleted the rebuild's backup.restore-all --as-of 10:56then silently fell back to the newest snapshot before it, from the day before. That one happened to be a previous rebuild's fresh-volume backup.Nextcloud wasn't affected: its database comes back from a dump, and its files hadn't changed.
Fix: the default per-app retention adds
within = "7d"(--keep-within), so every backup of the last week stays. With the usual one backup a day, that costs nothing extra.Test:
vm-app-backupstakes two backups the same day, then restores as of the first. It returns the first with the fix, and an older snapshot without it (both run locally).Live: Pi-hole and WireGuard were restored from their last good snapshot (the 19th, verified in the earlier rebuild), and the data fingerprints are identical to before the rebuild. Fresh backups were taken right after.
🤖 Generated with Claude Code