With borg 1.1.7 on ubuntu 18.10:
borg prune <borg_dir> --dry-run --list --stats --keep-last 1
...
Original size Compressed size Deduplicated size
Deleted data: 0 B 0 B 0 B
All archives: 981.25 GB 793.40 GB 112.32 GB
Unique chunks Total chunks
Chunk index: 250054 2164226
borg prune <borg_dir> --list --stats --keep-last 1
...
Original size Compressed size Deduplicated size
Deleted data: -820.45 GB -669.72 GB -9.60 GB
All archives: 160.80 GB 123.69 GB 102.72 GB
Unique chunks Total chunks
Chunk index: 237044 371408
Pruning worked as I wanted it to, but the dry run stats do not give an accurate preview.
Likely, that is simply not implemented (just guessing, needs to be checked in the src).
I had the look at the src:
borg prune --dry-run is to see what archives would be deleted (pruned) and what would be kept. this is mostly to avoid calling it with wrong arguments and losing backups (if called w/o -dry-run).archive.delete() (and stats are updated there, for real runs), there is no way it can show accurate stats with --dry-run.Proposed fix:
emit an error message saying --dry-run and --stats can't be used together.
If this is still available, could i work on this issue.
sure, go for it, make a PR.
@4rund3v did you have a look?
@ThomasWaldmann
some tests do use --dry-run and --stats together
i think we could add a simple check in archiver.run would that be appropriate ?
@user062 yes. there already some such checks.
Rather than exiting when someone uses --dry-run and --stats together, could we instead give then a warning and continue to run the dry-run while ignoring the stats?
My reasoning is that this current change breaks my wrapper script's current succinct of handling real/dry purges ( https://notabug.org/demure/scripts/src/master/borg_wrap.sh#L138-L150 ).
If the decision is to leave this as is, I'll just make my wrapper list two full commands I suppose, but this feel like an unintended roadblock so I figured I'd point it out.
ps. sorry I didn't notice this sooner, but I haven't pruned in a long time.
OK, guess we can do that, reopening...
Fixed in 1.1-maint, todo for master.