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 π₯
π 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
- alpine 3.24: borgbackup-doc 1.4.5-r0 Β· BSD-3-Clause
- arch rolling: borg 1.4.5-1 Β· BSD
- ubuntu stonking: borgbackup 1.4.5-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms