Repository navigation
Remove a tar backup that failed instead of keeping it - #343
Merged
Merged
Conversation
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.
When tar fails with a fatal error, for example because the backup volume is full, the partly written archive stays in
DEST_DIR. The count prune then counts it as the newest backup and deletes a good one to make room for it. Thelatestlink also moves to the broken file, sorestore-tar-backupandlatest.tar.gzboth pick it.Run with three good backups,
PRUNE_BACKUPS_COUNT=3and a full disk (simulated withulimit -f):That leaves two good backups and a truncated
world-20261203-093159.tar.gz(gzip -t: unexpected end of file). While the disk stays full, every interval repeats this, until only broken archives are left.On a tar exit code above 1,
backup()now deletes${outFile}and returns before updating thelatestlink. Exit code 1 (files changed while being read; the archive is fine) behaves as before.Testing: ran
backup-loop.shdirectly withrcon-clistubbed, before and after. With this change, the incomplete archive is removed and all three good backups are kept. A normal run still writes a valid archive and prunes the oldest. shellcheck shows no new findings.