BTRFS-BACKUP-NG-PRUNE(1)

πŸ“¦
version 0.9.20 Β· 2 versions
, in fedora 43, fedora 44

πŸ’– btrfs-backup-ng-prune β€” apply retention policies ✨

okay bestie, this is the manual page for btrfs-backup-ng-prune, one of the btrfs-backup-ng girlies. she's the one who does the cleanup. you're gonna love her, fr fr. πŸ§ΉπŸ’…


🌸 SYNOPSIS 🌸

btrfs-backup-ng prune [OPTIONS]

πŸŽ€ DESCRIPTION πŸŽ€

So. btrfs-backup-ng prune applies retention policies to clean up your old snapshots and backups. she goes through every snapshot one by one, checks it against the retention rules you configured, and yeets the ones that exceed the limits. iconic behavior, no notes. ✨

πŸ¦‹ snapper girlies, listen up: a volume whose source is snapper gets pruned on its destinations only, under each target's own retention policy. the decision and the deletion run are the same ones that happen after a transfer. the numbered slots below .snapshots on the destination? those are the backups, and they're dated from their info.xml. the source, meanwhile, is snapper's own timeline β€” snapper's cleanup algorithms run that. this command never deletes a snapper snapshot on the source. not ever. periodt. πŸ’€

Retention gets evaluated with these rules:

  1. min β€” absolute minimum retention. nothing gets deleted before this age. nothing. she's patient. 🫢
  2. the time buckets (hourly, daily, weekly, monthly, yearly) get evaluated newest-to-oldest. πŸ”₯
  3. the oldest snapshot in each time bucket is kept β€” that's the first-of-interval representative, matching the btrbk/snapper convention. yes ma'am. πŸ‘‘
  4. the latest snapshot is always preserved. always always. the main character. 🌟
  5. for raw (stream-file) targets, a parent stream that a kept incremental backup still needs is never deleted β€” deleting it would make the newer backup unrestorable 😭. for btrfs targets, a pruned parent just means the next backup has to be a full send. no biggie, just slower. 🐌
✨ Note on durations, bestie, this one matters: min values in months or years (1M, 1y) are calendar-aware in this version β€” 1M is one calendar month (aligned with the monthly bucket), not a flat 30 days. weekly buckets use ISO‐8601 week numbering, so a week that straddles a year boundary is counted once. a min of all keeps every snapshot in that scope and prunes nothing there. and an invalid min value now fails loudly (the volume gets skipped) instead of silently defaulting. she learned boundaries. πŸ’…

🚨 SAFETY 🚨

On an interactive terminal, a real (non‐--dry-run) prune prints the full deletion plan and prompts you for confirmation before deleting anything. if you decline, it aborts with no deletions. no harm no foul. 🫢

In a non‐interactive context (cron, a pipe) the prompt gets skipped and prune just proceeds β€” so use --yes if you want to skip the prompt in an interactive terminal too.

A degenerate policy that would keep only the latest snapshot (all time buckets 0 and min ≀ 1 day) is refused, deleting nothing, unless you pass --force β€” and this is enforced even non‐interactively, so a misconfiguration cannot silently wipe your history. πŸ’€πŸ˜­

A short‐window policy with a real min (say, 30d with zero buckets) is not degenerate. she knows the difference. she's smart like that. 🧠✨


πŸ’… OPTIONS πŸ’…

  • --dry-run β€” show what would be deleted without making any changes, snapper destination slots included. highly recommended before running prune for the first time. like, pls do this first bestie πŸ™ˆ
  • --yes, -y β€” skip the interactive confirmation prompt (for automation). πŸ€–
  • --force β€” prune even under a degenerate policy that would keep only the latest snapshot. use with intention. πŸ”₯

🌈 EXAMPLES 🌈

Show what would be pruned (dry run):

btrfs-backup-ng prune --dry-run

Apply retention policies (prompts on an interactive terminal):

btrfs-backup-ng prune

Non‐interactive / automation (skip the prompt):

btrfs-backup-ng prune --yes

Intentionally prune under a keep‐only‐latest policy:

btrfs-backup-ng prune --force

πŸ“ RETENTION CONFIGURATION πŸ“

Example retention settings in config.toml:

[global.retention]
min = "1d"      # Keep everything for at least 1 day
hourly = 24    # Then keep 24 hourly snapshots
daily = 7      # Then keep 7 daily snapshots
weekly = 4     # Then keep 4 weekly snapshots
monthly = 12   # Then keep 12 monthly snapshots
yearly = 0     # Don't keep yearly (0 = disabled)

πŸ‘€ SEE ALSO πŸ‘€

btrfs-backup-ng(1), btrfs-backup-ng-run(1)


anyway that's the whole page bestie, go forth and prune responsibly πŸ’œ this was btrfs-backup-ng, July 2026, signing off. slay, stay safe, and always --dry-run first πŸŽ€βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from