mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-18 05:58:17 +01:00
fix(restic): drop a stale btrfs snapshot before taking a new one
Cleanup runs as ExecStopPost, which a power loss mid-backup skips; the leftover @restic-snapshot then failed every later run. Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
1 parent
32620ed9db
commit
8b22aec1bb
1 file changed
+4
@@ -200,7 +200,11 @@ in
|
||||
}
|
||||
|
||||
// lib.optionalAttrs (cfg.snapshotSource != null) {
|
||||
# Left behind if a backup was cut off by a power loss.
|
||||
backupPrepareCommand = ''
|
||||
if [ -e ${snapshotPath} ]; then
|
||||
${pkgs.btrfs-progs}/bin/btrfs subvolume delete ${snapshotPath}
|
||||
fi
|
||||
${pkgs.btrfs-progs}/bin/btrfs subvolume snapshot -r ${cfg.snapshotSource} ${snapshotPath}
|
||||
'';
|
||||
backupCleanupCommand = ''
|
||||
|
||||
Reference in new issue
Block a user