| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 | .\" 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-04-18" "" "borg backup tool".SH NAMEborg-check \- Check repository consistency.SH SYNOPSIS.spborg [common options] check [options] [REPOSITORY_OR_ARCHIVE].SH DESCRIPTION.spThe check command verifies the consistency of a repository and its archives.It consists of two major steps:.INDENT 0.0.IP 1. 3Checking the consistency of the repository itself. This includes checkingthe segment magic headers, and both the metadata and data of all objects inthe segments. The read data is checked by size and CRC. Bit rot and othertypes of accidental damage can be detected this way. Running the repositorycheck can be split into multiple partial checks using \fB\-\-max\-duration\fP\&.When checking a remote repository, please note that the checks run on theserver and do not cause significant network traffic..IP 2. 3Checking consistency and correctness of the archive metadata and optionallyarchive data (requires \fB\-\-verify\-data\fP). This includes ensuring that therepository manifest exists, the archive metadata chunk is present, and thatall chunks referencing files (items) in the archive exist. This requiresreading archive and file metadata, but not data. To cryptographically verifythe file (content) data integrity pass \fB\-\-verify\-data\fP, but keep in mindthat this requires reading all data and is hence very time consuming. Whenchecking archives of a remote repository, archive checks run on the clientmachine because they require decrypting data and therefore the encryptionkey..UNINDENT.spBoth steps can also be run independently. Pass \fB\-\-repository\-only\fP to run therepository checks only, or pass \fB\-\-archives\-only\fP to run the archive checksonly..spThe \fB\-\-max\-duration\fP option can be used to split a long\-running repositorycheck into multiple partial checks. After the given number of seconds the checkis interrupted. The next partial check will continue where the previous onestopped, until the full repository has been checked. Assuming a complete checkwould 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 fullrepository check aborts any previous partial check; the next partial check willrestart from the beginning. With partial repository checks you can run neitherarchive 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 it with\fB\-\-max\-duration\fP) can only perform non\-cryptographic checksum checks on thesegment files. A full repository check (i.e. without \fB\-\-max\-duration\fP) canalso do a repository index check. Enabling partial repository checks exceptsarchive checks for the same reason. Therefore partial checks may be useful withvery large repositories only where a full check would take too long..spThe \fB\-\-verify\-data\fP option will perform a full integrity verification (asopposed to checking the CRC32 of the segment) of data, which means reading thedata from the repository, decrypting and decompressing it. It is a completecryptographic verification and hence very time consuming, but will detect anyaccidental and malicious corruption. Tamper\-resistance is only guaranteed forencrypted repositories against attackers without access to the keys. You cannot use \fB\-\-verify\-data\fP with \fB\-\-repository\-only\fP\&..SS About repair mode.spThe check command is a readonly task by default. If any corruption is found,Borg will report the issue and proceed with checking. To actually repair theissues 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 dataloss! This does not just include data that was previously lost anyway, butmight include more data for kinds of corruption it is not capable ofdealing with. \fBBE VERY CAREFUL!\fP.UNINDENT.UNINDENT.spPursuant to the previous warning it is also highly recommended to test thereliability of the hardware running Borg with stress testing software. Thisespecially includes storage and memory testers. Unreliable hardware might leadto additional data loss..spIt is highly recommended to create a backup of your repository before runningin repair mode (i.e. running it with \fB\-\-repair\fP)..spRepair mode will attempt to fix any corruptions found. Fixing corruptions doesnot mean recovering lost data: Borg can not magically restore data lost due toe.g. a hardware failure. Repairing a repository means sacrificing some datafor the sake of the repository as a whole and the remaining data. Hence it is,by definition, a potentially lossy task..spIn practice, repair mode hooks into both the repository and archive checks:.INDENT 0.0.IP 1. 3When checking the repository\(aqs consistency, repair mode will try to recoveras many objects from segments with integrity errors as possible, and ensurethat the index is consistent with the data stored in the segments..IP 2. 3When checking the consistency and correctness of archives, repair mode mightremove whole archives from the manifest if their archive metadata chunk iscorrupt or lost. On a chunk level (i.e. the contents of files), repair modewill replace corrupt or lost chunks with a same\-size replacement chunk ofzeroes. If a previously zeroed chunk reappears, repair mode will restorethis lost chunk using the new chunk. Lastly, repair mode will also deleteorphaned chunks (e.g. caused by read errors while creating the archive)..UNINDENT.spMost steps taken by repair mode have a one\-time effect on the repository, likeremoving a lost archive from the repository. However, replacing a corrupt orlost chunk with an all\-zero replacement will have an ongoing effect on therepository: When attempting to extract a file referencing an all\-zero chunk,the \fBextract\fP command will distinctly warn about it. The FUSE filesystemcreated by the \fBmount\fP command will reject reading such a \(dqzero\-patched\(dqfile unless a special mount option is given..spAs mentioned earlier, Borg might be able to \(dqheal\(dq a \(dqzero\-patched\(dq file inrepair mode, if all its previously lost chunks reappear (e.g. via a laterbackup). This is achieved by Borg not only keeping track of the all\-zeroreplacement chunks, but also by keeping metadata about the lost chunks. Inrepair mode Borg will check whether a previously lost chunk reappeared and willreplace the all\-zero replacement chunk by the reappeared chunk. If all lostchunks of a \(dqzero\-patched\(dq file reappear, this effectively \(dqheals\(dq the file.Consequently, if lost chunks were repaired earlier, it is advised to run\fB\-\-repair\fP a second time after creating some new backups..SH OPTIONS.spSee \fIborg\-common(1)\fP for common options of Borg commands..SS arguments.INDENT 0.0.TP.B REPOSITORY_OR_ARCHIVErepository or archive to check consistency of.UNINDENT.SS options.INDENT 0.0.TP.B  \-\-repository\-onlyonly perform repository checks.TP.B  \-\-archives\-onlyonly perform archives checks.TP.B  \-\-verify\-dataperform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP).TP.B  \-\-repairattempt to repair any inconsistencies found.TP.B  \-\-save\-spacework slower, but using less space.TP.BI \-\-max\-duration \ SECONDSdo only a partial repo check for max. SECONDS seconds (Default: unlimited).UNINDENT.SS Archive filters.INDENT 0.0.TP.BI \-P \ PREFIX\fR,\fB \ \-\-prefix \ PREFIXonly consider archive names starting with this prefix. (deprecated).TP.BI \-a \ GLOB\fR,\fB \ \-\-glob\-archives \ GLOBonly consider archive names matching the glob. sh: rules apply (without actually using the sh: prefix), see \(dqborg help patterns\(dq..TP.BI \-\-sort\-by \ KEYSComma\-separated list of sorting keys; valid keys are: timestamp, archive, name, id; default is: timestamp.TP.BI \-\-first \ Nconsider first N archives after other filters were applied.TP.BI \-\-last \ Nconsider last N archives after other filters were applied.UNINDENT.SH SEE ALSO.sp\fIborg\-common(1)\fP.SH AUTHORThe Borg Collective.\" Generated by docutils manpage writer..
 |