Retention and prune Preview
Backups grow with every snapshot. forget decides which snapshots to keep, protect marks the ones that must never go, and prune reclaims the space the rest used.
Forget by rule#
sqz backup forget <repo> --keep-last N [--keep-hourly N] [--keep-daily N] [--keep-weekly N]
[--keep-monthly N] [--keep-yearly N] [--dry-run] [--prune]
Always try a rule with --dry-run first. It prints what would be kept and removed, and changes nothing:
sqz backup forget D:\backups\laptop --keep-last 5 --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --dry-run
sqz backup forget D:\backups\laptop --keep-last 5 --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune
Each --keep-* rule keeps the newest snapshot of each of that many periods (hours, days, weeks, months or years, in UTC). A snapshot kept by any rule stays. --prune runs prune straight after.
Forget chosen snapshots#
sqz backup forget D:\backups\laptop 3 4 7
Removes the snapshots you name (by number or ID prefix).
What is never forgotten#
- The newest snapshot.
- The latest verified snapshot: the newest one
check --read-data(or a fulldrill) verified on this computer. - Protected snapshots:
sqz backup protect D:\backups\laptop 12 # never forget snapshot 12
sqz backup unprotect D:\backups\laptop 12
list shows which snapshots are protected and which is verified.
Prune#
sqz backup prune <repo> [--dry-run] [--grace HOURS] [--max-waste PERCENT]
sqz backup prune D:\backups\laptop --dry-run
sqz backup prune D:\backups\laptop
forget only removes snapshot records; the data they used stays until prune. Prune works out what the remaining snapshots still need, then:
- rewrites partly used packs, copying the still-needed pieces as they are, without decrypting them;
- writes one consolidated index;
- reads the new files back to check them;
- only then deletes the old index files, and last the old packs.
Stopping prune at any point loses nothing: the repository still checks clean apart from unused data, and the next prune finishes the job. Prune refuses to start if any snapshot, index or needed pack is unreadable, and changes nothing in that case.
--grace HOURS(default 24): files younger than this are neither rewritten nor deleted, in case a backup is still writing them.--max-waste PERCENT(default 5): how much unused space a pack may hold before it is worth rewriting.
A restore that started before prune can fail with a missing pack. It never returns wrong data, but it has to be run again.
What it saves#
In a test, a 1.2 GB repository grew to 1,432 MB over 8 more snapshots (each replacing a 32 MB file and changing 200 small ones). forget --keep-last 2 and prune brought it down to 955 MB in under 2 seconds. Prune's cost follows the data kept, not the data removed.
A sensible schedule#
- Back up daily with
run. - Weekly:
forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 5 --prune. - Monthly:
check --read-datato verify everything and mark a verified recovery point. - Protect snapshots you must keep regardless, such as the one before a big reorganisation.