borg compact

borg [common options] compact [options] REPOSITORY
positional arguments
  REPOSITORY repository to compact
optional arguments
  --cleanup-commits cleanup commit-only 17-byte segment files

Common options


This command frees repository space by compacting segments.

Use this regularly to avoid running out of space - you do not need to use this after each borg command though.

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.

See Separate compaction in Additional Notes for more details.


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

# same as above plus clean up 17byte commit-only segments,
# use this one time after upgrading borg (server) to 1.2+
# to clean up the tiny segments files created by borg 1.1:
$ borg compact --cleanup-commits /path/to/repo