borg-compact(1)

πŸ’– NAME πŸ’–

okay so bestie, welcome to borg-compact β€” this is the borg backup tool's little housekeeper that compacts segment files in the repository 🧹✨


✨ SYNOPSIS ✨

borg [common options] compact [options] [REPOSITORY]

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this command frees repository space by compacting segments. that's the whole vibe 🫢

use this regularly to avoid running out of space, bestie β€” but no cap, you do not need to run it after each borg command. it is especially useful after deleting archives, because only compaction will really free repository space. like, deleting alone is giving "I moved it to the void" and compaction is the actual cleanup πŸ’…

borg compact does not need a key, so it is possible to invoke it from the client or also from the server 🌸

depending on the amount of segments that need compaction, it may take a while, so consider using the --progress option ⏳

a segment is compacted if the amount of saved space is above the percentage value given by the --threshold option. if omitted, a threshold of 10% is used. when using --verbose, borg will output an estimate of the freed space πŸ‘‘

for maximum compaction, use --threshold 0. this will compact whenever any space can be saved and thus rewrites the most data; it can be much slower on large repositories. using --threshold 1 usually achieves nearly the same result significantly faster. higher thresholds (e.g. the default 10) trade compaction thoroughness for speed. Note: --threshold 100 will effectively compact nothing πŸ’€

after upgrading borg (server) to 1.2+, you can use borg compact --cleanup-commits to clean up the numerous 17-byte commit-only segments that borg 1.1 did not clean up due to a bug. it is enough to do that once per repository. after cleaning up the commits, borg will also do a normal compaction πŸŽ€

see separate_compaction in Additional Notes for more details.


πŸŽ€ OPTIONS πŸŽ€

see borg-common(1) for common options of Borg commands.

🌈 arguments

  • REPOSITORY β€” repository to compact

πŸ’œ options

  • -n, --dry-run β€” do nothing (yes really, that's the whole thing, it just does nothing πŸ™ˆ)
  • --cleanup-commits β€” cleanup commit-only 17-byte segment files
  • --threshold PERCENT β€” set minimum threshold for saved space in PERCENT (Default: 10)

⭐ EXAMPLES ⭐

# compact segments and free repo disk space
$ borg compact /path/to/repo

# same as above plus clean up 17-byte commit-only segments
$ borg compact --cleanup-commits /path/to/repo

πŸ”₯ SEE ALSO πŸ”₯

borg-common(1)


πŸ’… Author πŸ’…

The Borg Collective


and that's a wrap bestie 🫢 this was borg-compact(1) from the borg backup tool, dated 2026-07-18 β€” go free that repo space, you absolute icon πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from