borg [common options] check [options] [REPOSITORY_OR_ARCHIVE]
positional arguments | ||
REPOSITORY_OR_ARCHIVE |
repository or archive to check consistency of | |
options | ||
--repository-only |
only perform repository checks | |
--archives-only |
only perform archives checks | |
--verify-data |
perform cryptographic archive data integrity verification (conflicts with --repository-only ) |
|
--repair |
attempt to repair any inconsistencies found | |
--save-space |
work slower, but using less space | |
--max-duration SECONDS |
do only a partial repo check for max. SECONDS seconds (Default: unlimited) | |
Archive filters — Archive filters can be applied to repository targets. | ||
-P PREFIX , --prefix PREFIX |
only consider archive names starting with this prefix. (deprecated) | |
-a GLOB , --glob-archives GLOB |
only consider archive names matching the glob. sh: rules apply, see “borg help patterns”. | |
--sort-by KEYS |
Comma-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp | |
--first N |
consider first N archives after other filters were applied | |
--last N |
consider last N archives after other filters were applied |
The check command verifies the consistency of a repository and the corresponding archives.
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!
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.
First, the underlying repository data files are checked:
ssh:
, the repo check is executed on the server
without causing significant network traffic.--archives-only
option.--max-duration
option.Second, the consistency and correctness of the archive metadata is verified:
--repository-only
as this mode
only makes sense if the archive checks are enabled. The full details of this mode
are documented below.ssh:
, 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.--repository-only
option.The --max-duration
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 complete check took 7
hours, then running a daily check with --max-duration=3600 (1 hour) resulted in one
completed check per week.
Attention: A partial --repository-only check can only do way less checking than a full
--repository-only check: only the non-cryptographic checksum checks on segment file
entries are done, while a full --repository-only check would also do a repo index check.
A partial check cannot be combined with the --repair
option. Partial checks
may therefore be useful only with very large repositories where a full check would take
too long.
Doing a full repository check aborts a partial check; the next partial check will restart
from the beginning.
The --verify-data
option will perform a full integrity verification (as opposed to
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
tamper-resistant as well, unless the attacker has access to the keys. It is also very
slow.