borgbackup/docs/man/borg-compact.1

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
3.3 KiB
Groff
Raw Normal View History

2026-03-15 09:34:31 -04:00
.\" Man page generated from reStructuredText
.\" by the Docutils 0.22.4 manpage writer.
2018-07-12 16:00:19 -04:00
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
2026-06-16 08:17:43 -04:00
.TH "borg-compact" "1" "2026-06-16" "" "borg backup tool"
2026-03-15 09:34:31 -04:00
.SH Name
2025-12-23 12:00:09 -05:00
borg-compact \- Collects garbage in the repository.
2018-07-12 16:00:19 -04:00
.SH SYNOPSIS
.sp
2022-06-23 19:19:19 -04:00
borg [common options] compact [options]
2018-07-12 16:00:19 -04:00
.SH DESCRIPTION
.sp
2024-09-07 16:31:48 -04:00
Free repository space by deleting unused chunks.
2018-07-12 16:00:19 -04:00
.sp
2025-12-23 12:00:09 -05:00
\fBborg compact\fP analyzes all existing archives to determine which repository
2024-11-16 14:14:16 -05:00
objects are actually used (referenced). It then deletes all unused objects
from the repository to free space.
2018-07-12 16:00:19 -04:00
.sp
2024-11-16 14:14:16 -05:00
Unused objects may result from:
.INDENT 0.0
.IP \(bu 2
2025-12-23 12:00:09 -05:00
use of \fBborg delete\fP or \fBborg prune\fP
2024-11-16 14:14:16 -05:00
.IP \(bu 2
2025-12-23 12:00:09 -05:00
interrupted backups (consider retrying the backup before running compact)
2024-11-16 14:14:16 -05:00
.IP \(bu 2
2025-12-23 12:00:09 -05:00
backups of source files that encountered an I/O error mid\-transfer and were skipped
2024-11-16 14:14:16 -05:00
.IP \(bu 2
2025-12-23 12:00:09 -05:00
corruption of the repository (e.g., the archives directory lost entries; see notes below)
2024-11-16 14:14:16 -05:00
.UNINDENT
.sp
2025-12-23 12:00:09 -05:00
You usually do not want to run \fBborg compact\fP after every write operation, but
either regularly (e.g., once a month, possibly together with \fBborg check\fP) or
2024-11-16 14:14:16 -05:00
when disk space needs to be freed.
.sp
\fBImportant:\fP
.sp
2025-12-23 12:00:09 -05:00
After compacting, it is no longer possible to use \fBborg undelete\fP to recover
2024-11-16 14:14:16 -05:00
previously soft\-deleted archives.
.sp
\fBborg compact\fP might also delete data from archives that were \(dqlost\(dq due to
archives directory corruption. Such archives could potentially be restored with
\fBborg check \-\-find\-lost\-archives [\-\-repair]\fP, which is slow. You therefore
2025-12-23 12:00:09 -05:00
might not want to do that unless there are signs of lost archives (e.g., when
2024-11-16 14:14:16 -05:00
seeing fatal errors when creating backups or when archives are missing in
\fBborg repo\-list\fP).
2025-04-21 15:07:46 -04:00
.sp
2025-12-23 12:00:09 -05:00
When using the \fB\-\-stats\fP option, borg will internally list all repository
objects to determine their existence and stored size. It will build a fresh
2025-04-21 15:07:46 -04:00
chunks index from that information and cache it in the repository. For some
types of repositories, this might be very slow. It will tell you the sum of
stored object sizes, before and after compaction.
.sp
Without \fB\-\-stats\fP, borg will rely on the cached chunks index to determine
existing object IDs (but there is no stored size information in the index,
2025-12-23 12:00:09 -05:00
thus it cannot compute before/after compaction size statistics).
2018-07-12 16:00:19 -04:00
.SH OPTIONS
.sp
See \fIborg\-common(1)\fP for common options of Borg commands.
2025-04-21 15:07:46 -04:00
.SS options
.INDENT 0.0
.TP
.B \-n\fP,\fB \-\-dry\-run
2025-12-23 12:00:09 -05:00
do not change the repository
2025-04-21 15:07:46 -04:00
.TP
.B \-s\fP,\fB \-\-stats
print statistics (might be much slower)
.UNINDENT
2018-07-12 16:00:19 -04:00
.SH EXAMPLES
.INDENT 0.0
.INDENT 3.5
.sp
2025-04-21 15:07:46 -04:00
.EX
2025-12-23 12:00:09 -05:00
# Compact segments and free repository disk space
2022-06-23 19:19:19 -04:00
$ borg compact
2025-04-21 15:07:46 -04:00
.EE
2018-07-12 16:00:19 -04:00
.UNINDENT
.UNINDENT
.SH SEE ALSO
.sp
\fIborg\-common(1)\fP
2026-03-15 09:34:31 -04:00
.SH Author
2018-07-12 16:00:19 -04:00
The Borg Collective
2026-03-15 09:34:31 -04:00
.\" End of generated man page.