borg-check.1 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 "2022-12-24" "" "borg backup tool"
  31. .SH NAME
  32. borg-check \- Check repository consistency
  33. .SH SYNOPSIS
  34. .sp
  35. borg [common options] check [options] [REPOSITORY_OR_ARCHIVE]
  36. .SH DESCRIPTION
  37. .sp
  38. The check command verifies the consistency of a repository and the corresponding archives.
  39. .sp
  40. check \-\-repair is a potentially dangerous function and might lead to data loss
  41. (for kinds of corruption it is not capable of dealing with). BE VERY CAREFUL!
  42. .sp
  43. Pursuant to the previous warning it is also highly recommended to test the
  44. reliability of the hardware running this software with stress testing software
  45. such as memory testers. Unreliable hardware can also lead to data loss especially
  46. when this command is run in repair mode.
  47. .sp
  48. First, the underlying repository data files are checked:
  49. .INDENT 0.0
  50. .IP \(bu 2
  51. For all segments, the segment magic header is checked.
  52. .IP \(bu 2
  53. For all objects stored in the segments, all metadata (e.g. CRC and size) and
  54. all data is read. The read data is checked by size and CRC. Bit rot and other
  55. types of accidental damage can be detected this way.
  56. .IP \(bu 2
  57. In repair mode, if an integrity error is detected in a segment, try to recover
  58. as many objects from the segment as possible.
  59. .IP \(bu 2
  60. In repair mode, make sure that the index is consistent with the data stored in
  61. the segments.
  62. .IP \(bu 2
  63. If checking a remote repo via \fBssh:\fP, the repo check is executed on the server
  64. without causing significant network traffic.
  65. .IP \(bu 2
  66. The repository check can be skipped using the \fB\-\-archives\-only\fP option.
  67. .IP \(bu 2
  68. A repository check can be time consuming. Partial checks are possible with the
  69. \fB\-\-max\-duration\fP option.
  70. .UNINDENT
  71. .sp
  72. Second, the consistency and correctness of the archive metadata is verified:
  73. .INDENT 0.0
  74. .IP \(bu 2
  75. Is the repo manifest present? If not, it is rebuilt from archive metadata
  76. chunks (this requires reading and decrypting of all metadata and data).
  77. .IP \(bu 2
  78. Check if archive metadata chunk is present; if not, remove archive from manifest.
  79. .IP \(bu 2
  80. For all files (items) in the archive, for all chunks referenced by these
  81. files, check if chunk is present. In repair mode, if a chunk is not present,
  82. replace it with a same\-size replacement chunk of zeroes. If a previously lost
  83. chunk reappears (e.g. via a later backup), in repair mode the all\-zero replacement
  84. chunk will be replaced by the correct chunk. This requires reading of archive and
  85. file metadata, but not data.
  86. .IP \(bu 2
  87. In repair mode, when all the archives were checked, orphaned chunks are deleted
  88. from the repo. One cause of orphaned chunks are input file related errors (like
  89. read errors) in the archive creation process.
  90. .IP \(bu 2
  91. In verify\-data mode, a complete cryptographic verification of the archive data
  92. integrity is performed. This conflicts with \fB\-\-repository\-only\fP as this mode
  93. only makes sense if the archive checks are enabled. The full details of this mode
  94. are documented below.
  95. .IP \(bu 2
  96. If checking a remote repo via \fBssh:\fP, the archive check is executed on the
  97. client machine because it requires decryption, and this is always done client\-side
  98. as key access is needed.
  99. .IP \(bu 2
  100. The archive checks can be time consuming; they can be skipped using the
  101. \fB\-\-repository\-only\fP option.
  102. .UNINDENT
  103. .sp
  104. The \fB\-\-max\-duration\fP option can be used to split a long\-running repository check
  105. into multiple partial checks. After the given number of seconds the check is
  106. interrupted. The next partial check will continue where the previous one stopped,
  107. until the complete repository has been checked. Example: Assuming a complete check took 7
  108. hours, then running a daily check with \-\-max\-duration=3600 (1 hour) resulted in one
  109. completed check per week.
  110. .sp
  111. Attention: A partial \-\-repository\-only check can only do way less checking than a full
  112. \-\-repository\-only check: only the non\-cryptographic checksum checks on segment file
  113. entries are done, while a full \-\-repository\-only check would also do a repo index check.
  114. A partial check cannot be combined with the \fB\-\-repair\fP option. Partial checks
  115. may therefore be useful only with very large repositories where a full check would take
  116. too long.
  117. Doing a full repository check aborts a partial check; the next partial check will restart
  118. from the beginning.
  119. .sp
  120. The \fB\-\-verify\-data\fP option will perform a full integrity verification (as opposed to
  121. checking the CRC32 of the segment) of data, which means reading the data from the
  122. repository, decrypting and decompressing it. This is a cryptographic verification,
  123. which will detect (accidental) corruption. For encrypted repositories it is
  124. tamper\-resistant as well, unless the attacker has access to the keys. It is also very
  125. slow.
  126. .SH OPTIONS
  127. .sp
  128. See \fIborg\-common(1)\fP for common options of Borg commands.
  129. .SS arguments
  130. .INDENT 0.0
  131. .TP
  132. .B REPOSITORY_OR_ARCHIVE
  133. repository or archive to check consistency of
  134. .UNINDENT
  135. .SS options
  136. .INDENT 0.0
  137. .TP
  138. .B \-\-repository\-only
  139. only perform repository checks
  140. .TP
  141. .B \-\-archives\-only
  142. only perform archives checks
  143. .TP
  144. .B \-\-verify\-data
  145. perform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP)
  146. .TP
  147. .B \-\-repair
  148. attempt to repair any inconsistencies found
  149. .TP
  150. .B \-\-save\-space
  151. work slower, but using less space
  152. .TP
  153. .BI \-\-max\-duration \ SECONDS
  154. do only a partial repo check for max. SECONDS seconds (Default: unlimited)
  155. .UNINDENT
  156. .SS Archive filters
  157. .INDENT 0.0
  158. .TP
  159. .BI \-P \ PREFIX\fR,\fB \ \-\-prefix \ PREFIX
  160. only consider archive names starting with this prefix. (deprecated)
  161. .TP
  162. .BI \-a \ GLOB\fR,\fB \ \-\-glob\-archives \ GLOB
  163. only consider archive names matching the glob. sh: rules apply, see \(dqborg help patterns\(dq.
  164. .TP
  165. .BI \-\-sort\-by \ KEYS
  166. Comma\-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp
  167. .TP
  168. .BI \-\-first \ N
  169. consider first N archives after other filters were applied
  170. .TP
  171. .BI \-\-last \ N
  172. consider last N archives after other filters were applied
  173. .UNINDENT
  174. .SH SEE ALSO
  175. .sp
  176. \fIborg\-common(1)\fP
  177. .SH AUTHOR
  178. The Borg Collective
  179. .\" Generated by docutils manpage writer.
  180. .