BORG-COMPACT(1) | borg backup tool | BORG-COMPACT(1) |
borg-compact - Collect garbage in repository
borg [common options] compact [options]
Free repository space by deleting unused chunks.
borg compact analyzes all existing archives to find out which repository objects are actually used (referenced). It then deletes all unused objects from the repository to free space.
Unused objects may result from:
You usually don't want to run borg compact after every write operation, but either regularly (e.g. once a month, possibly together with borg check) or when disk space needs to be freed.
Important:
After compacting it is no longer possible to use borg undelete to recover previously soft-deleted archives.
borg compact might also delete data from archives that were "lost" due to archives directory corruption. Such archives could potentially be restored with borg check --find-lost-archives [--repair], which is slow. You therefore might not want to do that unless there are signs of lost archives (e.g. when seeing fatal errors when creating backups or when archives are missing in borg repo-list).
See borg-common(1) for common options of Borg commands.
# compact segments and free repo disk space $ borg compact
borg-common(1)
The Borg Collective
2025-01-07 |