backup: align the storage backup with the hot backup, and guard disk in verify #618

Stängd
öppnade 2026-10-08 21:12:24 +00:00 av supernaut · 0 kommentarer
Ägare

What

Two sibling scripts differ from the ones they should match.

  • bitborg-backup-storage.sh.j2:76-84 runs restic backup under set -e. The hot script treats restic exit code 3 (some files vanished while scanning) as a warning (bitborg-backup-hot.sh.j2:156-163).
  • bitborg-backup-verify.sh.j2:51-55 decrypts to bundle.tar, extracts into the same directory and never removes the tar. It has no free-space check. The drill has both (the #131 guard, and early cleanup).

Why

The backup volume is shared by the local archives, the verify workdir and the drill workdir.

Failing case

  • A package is deleted while the storage backup scans. restic writes the snapshot and exits 3. The script stops, so forget --prune is skipped and the success timestamp is not written. The status flips to 1 although the snapshot exists.
  • The volume is at 85% on Sunday 04:30. Verify holds about 2x the bundle, fills the volume and Monday's 03:30 backup fails with ENOSPC.

Fix

Copy the hot script's rc=$? and rc -eq 3 handling into the storage script. In verify, abort when free space is below backup_drill_min_free_gb before age -d, and rm -f "${WORK}/bundle.tar" right after the extract.

Done when

  • Exit code 3 in the storage backup still prunes and records success with a warning.
  • Verify aborts early on low free space.
  • Verify peak usage is about 1x the bundle.
## What Two sibling scripts differ from the ones they should match. - `bitborg-backup-storage.sh.j2:76-84` runs `restic backup` under `set -e`. The hot script treats restic exit code 3 (some files vanished while scanning) as a warning (`bitborg-backup-hot.sh.j2:156-163`). - `bitborg-backup-verify.sh.j2:51-55` decrypts to `bundle.tar`, extracts into the same directory and never removes the tar. It has no free-space check. The drill has both (the #131 guard, and early cleanup). ## Why The backup volume is shared by the local archives, the verify workdir and the drill workdir. ## Failing case - A package is deleted while the storage backup scans. restic writes the snapshot and exits 3. The script stops, so `forget --prune` is skipped and the success timestamp is not written. The status flips to 1 although the snapshot exists. - The volume is at 85% on Sunday 04:30. Verify holds about 2x the bundle, fills the volume and Monday's 03:30 backup fails with ENOSPC. ## Fix Copy the hot script's `rc=$?` and `rc -eq 3` handling into the storage script. In verify, abort when free space is below `backup_drill_min_free_gb` before `age -d`, and `rm -f "${WORK}/bundle.tar"` right after the extract. ## Done when - [ ] Exit code 3 in the storage backup still prunes and records success with a warning. - [ ] Verify aborts early on low free space. - [ ] Verify peak usage is about 1x the bundle.
Logga in för att delta i denna konversation.
Ingen milstolpe
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra#618
Ingen beskrivning angiven.