1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 09:19:31 +00:00
borg/docs/man/borg-check.1

178 lines
6.6 KiB
Groff
Raw Normal View History

2017-02-05 13:22:06 +00:00
.\" 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
..
2022-02-19 17:48:13 +00:00
.TH "BORG-CHECK" 1 "2022-02-19" "" "borg backup tool"
2022-01-23 14:53:42 +00:00
.SH NAME
borg-check \- Check repository consistency
2017-02-05 13:22:06 +00:00
.SH SYNOPSIS
.sp
borg [common options] check [options] [REPOSITORY_OR_ARCHIVE]
2017-02-05 13:22:06 +00:00
.SH DESCRIPTION
.sp
The check command verifies the consistency of a repository and the corresponding archives.
.sp
2020-10-04 18:33:08 +00:00
check \-\-repair is a potentially dangerous function and might lead to data loss
(for kinds of corruption it is not capable of dealing with). BE VERY CAREFUL!
.sp
2022-01-23 14:53:42 +00:00
Pursuant to the previous warning it is also highly recommended to test the
reliability of the hardware running this software with stress testing software
such as memory testers. Unreliable hardware can also lead to data loss especially
when this command is run in repair mode.
.sp
2017-02-05 13:22:06 +00:00
First, the underlying repository data files are checked:
.INDENT 0.0
.IP \(bu 2
2020-04-12 17:55:57 +00:00
For all segments, the segment magic header is checked.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
2020-04-12 17:55:57 +00:00
For all objects stored in the segments, all metadata (e.g. CRC and size) and
2017-02-05 13:22:06 +00:00
all data is read. The read data is checked by size and CRC. Bit rot and other
types of accidental damage can be detected this way.
.IP \(bu 2
2020-04-12 17:55:57 +00:00
In repair mode, if an integrity error is detected in a segment, try to recover
as many objects from the segment as possible.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
2020-04-12 17:55:57 +00:00
In repair mode, make sure that the index is consistent with the data stored in
the segments.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
2020-04-12 17:55:57 +00:00
If checking a remote repo via \fBssh:\fP, the repo check is executed on the server
without causing significant network traffic.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
2017-06-18 10:13:28 +00:00
The repository check can be skipped using the \fB\-\-archives\-only\fP option.
2019-09-06 22:36:10 +00:00
.IP \(bu 2
2020-04-12 17:55:57 +00:00
A repository check can be time consuming. Partial checks are possible with the
\fB\-\-max\-duration\fP option.
2017-02-05 13:22:06 +00:00
.UNINDENT
.sp
Second, the consistency and correctness of the archive metadata is verified:
.INDENT 0.0
.IP \(bu 2
Is the repo manifest present? If not, it is rebuilt from archive metadata
chunks (this requires reading and decrypting of all metadata and data).
.IP \(bu 2
2020-04-12 17:55:57 +00:00
Check if archive metadata chunk is present; if not, remove archive from manifest.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
For all files (items) in the archive, for all chunks referenced by these
2020-04-12 17:55:57 +00:00
files, check if chunk is present. In repair mode, if a chunk is not present,
replace it with a same\-size replacement chunk of zeroes. If a previously lost
chunk reappears (e.g. via a later backup), in repair mode the all\-zero replacement
chunk will be replaced by the correct chunk. This requires reading of archive and
file metadata, but not data.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
2020-04-12 17:55:57 +00:00
In repair mode, when all the archives were checked, orphaned chunks are deleted
from the repo. One cause of orphaned chunks are input file related errors (like
read errors) in the archive creation process.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
2022-01-23 14:53:42 +00:00
In verify\-data mode, a complete cryptographic verification of the archive data
integrity is performed. This conflicts with \fB\-\-repository\-only\fP as this mode
only makes sense if the archive checks are enabled. The full details of this mode
are documented below.
.IP \(bu 2
2020-04-12 17:55:57 +00:00
If checking a remote repo via \fBssh:\fP, the archive check is executed on the
client machine because it requires decryption, and this is always done client\-side
as key access is needed.
2017-02-05 13:22:06 +00:00
.IP \(bu 2
2020-04-12 17:55:57 +00:00
The archive checks can be time consuming; they can be skipped using the
2017-06-18 10:13:28 +00:00
\fB\-\-repository\-only\fP option.
2017-02-05 13:22:06 +00:00
.UNINDENT
.sp
2020-04-12 17:55:57 +00:00
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 complete repository has been checked. Example: Assuming a full check took 7
hours, then running a daily check with \-\-max\-duration=3600 (1 hour) resulted in one
full check per week.
2019-09-06 22:36:10 +00:00
.sp
2020-04-12 17:55:57 +00:00
Attention: Partial checks can only do way less checking than a full check (only the
CRC32 checks on segment file entries are done), and cannot be combined with the
\fB\-\-repair\fP option. Partial checks may therefore be useful only with very large
repositories where a full check took too long. Doing a full repository check aborts a
partial check; the next partial check will restart from the beginning.
2019-09-06 22:36:10 +00:00
.sp
2017-06-18 10:13:28 +00:00
The \fB\-\-verify\-data\fP option will perform a full integrity verification (as opposed to
2017-02-05 13:22:06 +00:00
checking the CRC32 of the segment) of data, which means reading the data from the
repository, decrypting and decompressing it. This is a cryptographic verification,
which will detect (accidental) corruption. For encrypted repositories it is
2020-04-12 17:55:57 +00:00
tamper\-resistant as well, unless the attacker has access to the keys. It is also very
slow.
2017-02-05 13:22:06 +00:00
.SH OPTIONS
.sp
See \fIborg\-common(1)\fP for common options of Borg commands.
.SS arguments
.INDENT 0.0
.TP
.B REPOSITORY_OR_ARCHIVE
repository or archive to check consistency of
.UNINDENT
.SS optional arguments
.INDENT 0.0
.TP
2022-01-23 14:53:42 +00:00
.B \-\-repository\-only
2017-02-05 13:22:06 +00:00
only perform repository checks
.TP
2022-01-23 14:53:42 +00:00
.B \-\-archives\-only
2017-02-05 13:22:06 +00:00
only perform archives checks
.TP
2022-01-23 14:53:42 +00:00
.B \-\-verify\-data
2017-06-18 10:13:28 +00:00
perform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP)
2017-02-05 13:22:06 +00:00
.TP
2022-01-23 14:53:42 +00:00
.B \-\-repair
2017-02-05 13:22:06 +00:00
attempt to repair any inconsistencies found
.TP
2022-01-23 14:53:42 +00:00
.B \-\-save\-space
2017-02-05 13:22:06 +00:00
work slower, but using less space
2019-03-10 23:11:50 +00:00
.TP
.BI \-\-max\-duration \ SECONDS
do only a partial repo check for max. SECONDS seconds (Default: unlimited)
2017-02-05 13:22:06 +00:00
.UNINDENT
.SS Archive filters
2017-02-05 13:22:06 +00:00
.INDENT 0.0
.TP
2020-10-04 18:33:08 +00:00
.BI \-P \ PREFIX\fR,\fB \ \-\-prefix \ PREFIX
2017-06-18 10:13:28 +00:00
only consider archive names starting with this prefix.
.TP
2020-10-04 18:33:08 +00:00
.BI \-a \ GLOB\fR,\fB \ \-\-glob\-archives \ GLOB
2017-06-18 10:13:28 +00:00
only consider archive names matching the glob. sh: rules apply, see "borg help patterns". \fB\-\-prefix\fP and \fB\-\-glob\-archives\fP are mutually exclusive.
2017-02-05 13:22:06 +00:00
.TP
.BI \-\-sort\-by \ KEYS
2017-02-05 13:22:06 +00:00
Comma\-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp
.TP
.BI \-\-first \ N
consider first N archives after other filters were applied
.TP
.BI \-\-last \ N
consider last N archives after other filters were applied
.UNINDENT
.SH SEE ALSO
.sp
\fIborg\-common(1)\fP
.SH AUTHOR
The Borg Collective
.\" Generated by docutils manpage writer.
.