mirror of
https://github.com/borgbackup/borg.git
synced 2026-02-19 02:29:19 -05:00
203 lines
8.4 KiB
Groff
203 lines
8.4 KiB
Groff
.\" Man page generated from reStructuredText.
|
|
.
|
|
.
|
|
.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
|
|
..
|
|
.TH "BORG-CHECK" "1" "2025-12-23" "" "borg backup tool"
|
|
.SH NAME
|
|
borg-check \- Checks repository consistency.
|
|
.SH SYNOPSIS
|
|
.sp
|
|
borg [common options] check [options]
|
|
.SH DESCRIPTION
|
|
.sp
|
|
The check command verifies the consistency of a repository and its archives.
|
|
It consists of two major steps:
|
|
.INDENT 0.0
|
|
.IP 1. 3
|
|
Checking the consistency of the repository itself. This includes checking
|
|
the file magic headers, and both the metadata and data of all objects in
|
|
the repository. The read data is checked by size and hash. Bit rot and other
|
|
types of accidental damage can be detected this way. Running the repository
|
|
check can be split into multiple partial checks using \fB\-\-max\-duration\fP\&.
|
|
When checking an <ssh://> remote repository, please note that the checks run on
|
|
the server and do not cause significant network traffic.
|
|
.IP 2. 3
|
|
Checking consistency and correctness of the archive metadata and optionally
|
|
archive data (requires \fB\-\-verify\-data\fP). This includes ensuring that the
|
|
repository manifest exists, the archive metadata chunk is present, and that
|
|
all chunks referencing files (items) in the archive exist. This requires
|
|
reading archive and file metadata, but not data. To scan for archives whose
|
|
entries were lost from the archive directory, pass \fB\-\-find\-lost\-archives\fP\&.
|
|
It requires reading all data and is hence very time\-consuming.
|
|
To additionally cryptographically verify the file (content) data integrity,
|
|
pass \fB\-\-verify\-data\fP, which is even more time\-consuming.
|
|
.sp
|
|
When checking archives of a remote repository, archive checks run on the client
|
|
machine because they require decrypting data and therefore the encryption key.
|
|
.UNINDENT
|
|
.sp
|
|
Both steps can also be run independently. Pass \fB\-\-repository\-only\fP to run the
|
|
repository checks only, or pass \fB\-\-archives\-only\fP to run the archive checks
|
|
only.
|
|
.sp
|
|
The \fB\-\-max\-duration\fP option can be used to split a long\-running repository
|
|
check into multiple partial checks. After the given number of seconds, the check
|
|
is interrupted. The next partial check will continue where the previous one
|
|
stopped, until the full repository has been checked. Assuming a complete check
|
|
would take 7 hours, then running a daily check with \fB\-\-max\-duration=3600\fP
|
|
(1 hour) would result in one full repository check per week. Doing a full
|
|
repository check aborts any previous partial check; the next partial check will
|
|
restart from the beginning. With partial repository checks you can run neither
|
|
archive checks, nor enable repair mode. Consequently, if you want to use
|
|
\fB\-\-max\-duration\fP you must also pass \fB\-\-repository\-only\fP, and must not pass
|
|
\fB\-\-archives\-only\fP, nor \fB\-\-repair\fP\&.
|
|
.sp
|
|
\fBWarning:\fP Please note that partial repository checks (i.e., running with
|
|
\fB\-\-max\-duration\fP) can only perform non\-cryptographic checksum checks on the
|
|
repository files. Enabling partial repository checks excludes archive checks
|
|
for the same reason. Therefore, partial checks may be useful only with very large
|
|
repositories where a full check would take too long.
|
|
.sp
|
|
The \fB\-\-verify\-data\fP option will perform a full integrity verification (as
|
|
opposed to checking just the xxh64) of data, which means reading the
|
|
data from the repository, decrypting and decompressing it. It is a complete
|
|
cryptographic verification and hence very time\-consuming, but will detect any
|
|
accidental and malicious corruption. Tamper\-resistance is only guaranteed for
|
|
encrypted repositories against attackers without access to the keys. You cannot
|
|
use \fB\-\-verify\-data\fP with \fB\-\-repository\-only\fP\&.
|
|
.sp
|
|
The \fB\-\-find\-lost\-archives\fP option will also scan the whole repository, but
|
|
tells Borg to search for lost archive metadata. If Borg encounters any archive
|
|
metadata that does not match an archive directory entry (including
|
|
soft\-deleted archives), it means that an entry was lost.
|
|
Unless \fBborg compact\fP is called, these archives can be fully restored with
|
|
\fB\-\-repair\fP\&. Please note that \fB\-\-find\-lost\-archives\fP must read a lot of
|
|
data from the repository and is thus very time\-consuming. You cannot use
|
|
\fB\-\-find\-lost\-archives\fP with \fB\-\-repository\-only\fP\&.
|
|
.SS About repair mode
|
|
.sp
|
|
The check command is a read\-only task by default. If any corruption is found,
|
|
Borg will report the issue and proceed with checking. To actually repair the
|
|
issues found, pass \fB\-\-repair\fP\&.
|
|
.sp
|
|
\fBNOTE:\fP
|
|
.INDENT 0.0
|
|
.INDENT 3.5
|
|
\fB\-\-repair\fP is a \fBPOTENTIALLY DANGEROUS FEATURE\fP and might lead to data
|
|
loss! This does not just include data that was previously lost anyway, but
|
|
might include more data for kinds of corruption it is not capable of
|
|
dealing with. \fBBE VERY CAREFUL!\fP
|
|
.UNINDENT
|
|
.UNINDENT
|
|
.sp
|
|
Pursuant to the previous warning it is also highly recommended to test the
|
|
reliability of the hardware running Borg with stress testing software. This
|
|
especially includes storage and memory testers. Unreliable hardware might lead
|
|
to additional data loss.
|
|
.sp
|
|
It is highly recommended to create a backup of your repository before running
|
|
in repair mode (i.e. running it with \fB\-\-repair\fP).
|
|
.sp
|
|
Repair mode will attempt to fix any corruptions found. Fixing corruptions does
|
|
not mean recovering lost data: Borg cannot magically restore data lost due to
|
|
e.g. a hardware failure. Repairing a repository means sacrificing some data
|
|
for the sake of the repository as a whole and the remaining data. Hence it is,
|
|
by definition, a potentially lossy task.
|
|
.sp
|
|
In practice, repair mode hooks into both the repository and archive checks:
|
|
.INDENT 0.0
|
|
.IP 1. 3
|
|
When checking the repository\(aqs consistency, repair mode removes corrupted
|
|
objects from the repository after it did a 2nd try to read them correctly.
|
|
.IP 2. 3
|
|
When checking the consistency and correctness of archives, repair mode might
|
|
remove whole archives from the manifest if their archive metadata chunk is
|
|
corrupt or lost. Borg will also report files that reference missing chunks.
|
|
.UNINDENT
|
|
.sp
|
|
If \fB\-\-repair \-\-find\-lost\-archives\fP is given, previously lost entries will
|
|
be recreated in the archive directory. This is only possible before
|
|
\fBborg compact\fP would remove the archives\(aq data completely.
|
|
.SH OPTIONS
|
|
.sp
|
|
See \fIborg\-common(1)\fP for common options of Borg commands.
|
|
.SS options
|
|
.INDENT 0.0
|
|
.TP
|
|
.B \-\-repository\-only
|
|
only perform repository checks
|
|
.TP
|
|
.B \-\-archives\-only
|
|
only perform archive checks
|
|
.TP
|
|
.B \-\-verify\-data
|
|
perform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP)
|
|
.TP
|
|
.B \-\-repair
|
|
attempt to repair any inconsistencies found
|
|
.TP
|
|
.B \-\-find\-lost\-archives
|
|
attempt to find lost archives
|
|
.TP
|
|
.BI \-\-max\-duration \ SECONDS
|
|
perform only a partial repository check for at most SECONDS seconds (default: unlimited)
|
|
.UNINDENT
|
|
.SS Archive filters
|
|
.INDENT 0.0
|
|
.TP
|
|
.BI \-a \ PATTERN\fR,\fB \ \-\-match\-archives \ PATTERN
|
|
only consider archives matching all patterns. See \(dqborg help match\-archives\(dq.
|
|
.TP
|
|
.BI \-\-sort\-by \ KEYS
|
|
Comma\-separated list of sorting keys; valid keys are: timestamp, archive, name, id, tags, host, user; default is: timestamp
|
|
.TP
|
|
.BI \-\-first \ N
|
|
consider the first N archives after other filters are applied
|
|
.TP
|
|
.BI \-\-last \ N
|
|
consider the last N archives after other filters are applied
|
|
.TP
|
|
.BI \-\-oldest \ TIMESPAN
|
|
consider archives between the oldest archive\(aqs timestamp and (oldest + TIMESPAN), e.g., 7d or 12m.
|
|
.TP
|
|
.BI \-\-newest \ TIMESPAN
|
|
consider archives between the newest archive\(aqs timestamp and (newest \- TIMESPAN), e.g., 7d or 12m.
|
|
.TP
|
|
.BI \-\-older \ TIMESPAN
|
|
consider archives older than (now \- TIMESPAN), e.g., 7d or 12m.
|
|
.TP
|
|
.BI \-\-newer \ TIMESPAN
|
|
consider archives newer than (now \- TIMESPAN), e.g., 7d or 12m.
|
|
.UNINDENT
|
|
.SH SEE ALSO
|
|
.sp
|
|
\fIborg\-common(1)\fP
|
|
.SH AUTHOR
|
|
The Borg Collective
|
|
.\" Generated by docutils manpage writer.
|
|
.
|