borg-check.1 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .
  4. .nr rst2man-indent-level 0
  5. .
  6. .de1 rstReportMargin
  7. \\$1 \\n[an-margin]
  8. level \\n[rst2man-indent-level]
  9. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  10. -
  11. \\n[rst2man-indent0]
  12. \\n[rst2man-indent1]
  13. \\n[rst2man-indent2]
  14. ..
  15. .de1 INDENT
  16. .\" .rstReportMargin pre:
  17. . RS \\$1
  18. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  19. . nr rst2man-indent-level +1
  20. .\" .rstReportMargin post:
  21. ..
  22. .de UNINDENT
  23. . RE
  24. .\" indent \\n[an-margin]
  25. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  26. .nr rst2man-indent-level -1
  27. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  28. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  29. ..
  30. .TH "BORG-CHECK" 1 "2024-09-26" "" "borg backup tool"
  31. .SH NAME
  32. borg-check \- Check repository consistency
  33. .SH SYNOPSIS
  34. .sp
  35. borg [common options] check [options]
  36. .SH DESCRIPTION
  37. .sp
  38. The check command verifies the consistency of a repository and its archives.
  39. It consists of two major steps:
  40. .INDENT 0.0
  41. .IP 1. 3
  42. Checking the consistency of the repository itself. This includes checking
  43. the file magic headers, and both the metadata and data of all objects in
  44. the repository. The read data is checked by size and hash. Bit rot and other
  45. types of accidental damage can be detected this way. Running the repository
  46. check can be split into multiple partial checks using \fB\-\-max\-duration\fP\&.
  47. When checking a remote repository, please note that the checks run on the
  48. server and do not cause significant network traffic.
  49. .IP 2. 3
  50. Checking consistency and correctness of the archive metadata and optionally
  51. archive data (requires \fB\-\-verify\-data\fP). This includes ensuring that the
  52. repository manifest exists, the archive metadata chunk is present, and that
  53. all chunks referencing files (items) in the archive exist. This requires
  54. reading archive and file metadata, but not data. To cryptographically verify
  55. the file (content) data integrity pass \fB\-\-verify\-data\fP, but keep in mind
  56. that this requires reading all data and is hence very time consuming. When
  57. checking archives of a remote repository, archive checks run on the client
  58. machine because they require decrypting data and therefore the encryption
  59. key.
  60. .UNINDENT
  61. .sp
  62. Both steps can also be run independently. Pass \fB\-\-repository\-only\fP to run the
  63. repository checks only, or pass \fB\-\-archives\-only\fP to run the archive checks
  64. only.
  65. .sp
  66. The \fB\-\-max\-duration\fP option can be used to split a long\-running repository
  67. check into multiple partial checks. After the given number of seconds the check
  68. is interrupted. The next partial check will continue where the previous one
  69. stopped, until the full repository has been checked. Assuming a complete check
  70. would take 7 hours, then running a daily check with \fB\-\-max\-duration=3600\fP
  71. (1 hour) would result in one full repository check per week. Doing a full
  72. repository check aborts any previous partial check; the next partial check will
  73. restart from the beginning. With partial repository checks you can run neither
  74. archive checks, nor enable repair mode. Consequently, if you want to use
  75. \fB\-\-max\-duration\fP you must also pass \fB\-\-repository\-only\fP, and must not pass
  76. \fB\-\-archives\-only\fP, nor \fB\-\-repair\fP\&.
  77. .sp
  78. \fBWarning:\fP Please note that partial repository checks (i.e. running it with
  79. \fB\-\-max\-duration\fP) can only perform non\-cryptographic checksum checks on the
  80. repository files. Enabling partial repository checks excepts archive checks
  81. for the same reason. Therefore partial checks may be useful with very large
  82. repositories only where a full check would take too long.
  83. .sp
  84. The \fB\-\-verify\-data\fP option will perform a full integrity verification (as
  85. opposed to checking just the xxh64) of data, which means reading the
  86. data from the repository, decrypting and decompressing it. It is a complete
  87. cryptographic verification and hence very time consuming, but will detect any
  88. accidental and malicious corruption. Tamper\-resistance is only guaranteed for
  89. encrypted repositories against attackers without access to the keys. You can
  90. not use \fB\-\-verify\-data\fP with \fB\-\-repository\-only\fP\&.
  91. .SS About repair mode
  92. .sp
  93. The check command is a readonly task by default. If any corruption is found,
  94. Borg will report the issue and proceed with checking. To actually repair the
  95. issues found, pass \fB\-\-repair\fP\&.
  96. .sp
  97. \fBNOTE:\fP
  98. .INDENT 0.0
  99. .INDENT 3.5
  100. \fB\-\-repair\fP is a \fBPOTENTIALLY DANGEROUS FEATURE\fP and might lead to data
  101. loss! This does not just include data that was previously lost anyway, but
  102. might include more data for kinds of corruption it is not capable of
  103. dealing with. \fBBE VERY CAREFUL!\fP
  104. .UNINDENT
  105. .UNINDENT
  106. .sp
  107. Pursuant to the previous warning it is also highly recommended to test the
  108. reliability of the hardware running Borg with stress testing software. This
  109. especially includes storage and memory testers. Unreliable hardware might lead
  110. to additional data loss.
  111. .sp
  112. It is highly recommended to create a backup of your repository before running
  113. in repair mode (i.e. running it with \fB\-\-repair\fP).
  114. .sp
  115. Repair mode will attempt to fix any corruptions found. Fixing corruptions does
  116. not mean recovering lost data: Borg can not magically restore data lost due to
  117. e.g. a hardware failure. Repairing a repository means sacrificing some data
  118. for the sake of the repository as a whole and the remaining data. Hence it is,
  119. by definition, a potentially lossy task.
  120. .sp
  121. In practice, repair mode hooks into both the repository and archive checks:
  122. .INDENT 0.0
  123. .IP 1. 3
  124. When checking the repository\(aqs consistency, repair mode removes corrupted
  125. objects from the repository after it did a 2nd try to read them correctly.
  126. .IP 2. 3
  127. When checking the consistency and correctness of archives, repair mode might
  128. remove whole archives from the manifest if their archive metadata chunk is
  129. corrupt or lost. On a chunk level (i.e. the contents of files), repair mode
  130. will replace corrupt or lost chunks with a same\-size replacement chunk of
  131. zeroes. If a previously zeroed chunk reappears, repair mode will restore
  132. this lost chunk using the new chunk.
  133. .UNINDENT
  134. .sp
  135. Most steps taken by repair mode have a one\-time effect on the repository, like
  136. removing a lost archive from the repository. However, replacing a corrupt or
  137. lost chunk with an all\-zero replacement will have an ongoing effect on the
  138. repository: When attempting to extract a file referencing an all\-zero chunk,
  139. the \fBextract\fP command will distinctly warn about it. The FUSE filesystem
  140. created by the \fBmount\fP command will reject reading such a \(dqzero\-patched\(dq
  141. file unless a special mount option is given.
  142. .sp
  143. As mentioned earlier, Borg might be able to \(dqheal\(dq a \(dqzero\-patched\(dq file in
  144. repair mode, if all its previously lost chunks reappear (e.g. via a later
  145. backup). This is achieved by Borg not only keeping track of the all\-zero
  146. replacement chunks, but also by keeping metadata about the lost chunks. In
  147. repair mode Borg will check whether a previously lost chunk reappeared and will
  148. replace the all\-zero replacement chunk by the reappeared chunk. If all lost
  149. chunks of a \(dqzero\-patched\(dq file reappear, this effectively \(dqheals\(dq the file.
  150. Consequently, if lost chunks were repaired earlier, it is advised to run
  151. \fB\-\-repair\fP a second time after creating some new backups.
  152. .sp
  153. If \fB\-\-repair \-\-undelete\-archives\fP is given, Borg will scan the repository
  154. for archive metadata and if it finds some where no corresponding archives
  155. directory entry exists, it will create the entries. This is basically undoing
  156. \fBborg delete archive\fP or \fBborg prune ...\fP commands and only possible before
  157. \fBborg compact\fP would remove the archives\(aq data completely.
  158. .SH OPTIONS
  159. .sp
  160. See \fIborg\-common(1)\fP for common options of Borg commands.
  161. .SS optional arguments
  162. .INDENT 0.0
  163. .TP
  164. .B \-\-repository\-only
  165. only perform repository checks
  166. .TP
  167. .B \-\-archives\-only
  168. only perform archives checks
  169. .TP
  170. .B \-\-verify\-data
  171. perform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP)
  172. .TP
  173. .B \-\-repair
  174. attempt to repair any inconsistencies found
  175. .TP
  176. .B \-\-undelete\-archives
  177. attempt to undelete archives (use with \-\-repair)
  178. .TP
  179. .BI \-\-max\-duration \ SECONDS
  180. do only a partial repo check for max. SECONDS seconds (Default: unlimited)
  181. .UNINDENT
  182. .SS Archive filters
  183. .INDENT 0.0
  184. .TP
  185. .BI \-a \ PATTERN\fR,\fB \ \-\-match\-archives \ PATTERN
  186. only consider archive names matching the pattern. see \(dqborg help match\-archives\(dq.
  187. .TP
  188. .BI \-\-sort\-by \ KEYS
  189. Comma\-separated list of sorting keys; valid keys are: timestamp, archive, name, id; default is: timestamp
  190. .TP
  191. .BI \-\-first \ N
  192. consider first N archives after other filters were applied
  193. .TP
  194. .BI \-\-last \ N
  195. consider last N archives after other filters were applied
  196. .TP
  197. .BI \-\-oldest \ TIMESPAN
  198. consider archives between the oldest archive\(aqs timestamp and (oldest + TIMESPAN), e.g. 7d or 12m.
  199. .TP
  200. .BI \-\-newest \ TIMESPAN
  201. consider archives between the newest archive\(aqs timestamp and (newest \- TIMESPAN), e.g. 7d or 12m.
  202. .TP
  203. .BI \-\-older \ TIMESPAN
  204. consider archives older than (now \- TIMESPAN), e.g. 7d or 12m.
  205. .TP
  206. .BI \-\-newer \ TIMESPAN
  207. consider archives newer than (now \- TIMESPAN), e.g. 7d or 12m.
  208. .UNINDENT
  209. .SH SEE ALSO
  210. .sp
  211. \fIborg\-common(1)\fP
  212. .SH AUTHOR
  213. The Borg Collective
  214. .\" Generated by docutils manpage writer.
  215. .