borg-check.1 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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-02-19" "" "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 full check took 7
  108. hours, then running a daily check with \-\-max\-duration=3600 (1 hour) resulted in one
  109. full check per week.
  110. .sp
  111. Attention: Partial checks can only do way less checking than a full check (only the
  112. CRC32 checks on segment file entries are done), and cannot be combined with the
  113. \fB\-\-repair\fP option. Partial checks may therefore be useful only with very large
  114. repositories where a full check took too long. Doing a full repository check aborts a
  115. partial check; the next partial check will restart from the beginning.
  116. .sp
  117. The \fB\-\-verify\-data\fP option will perform a full integrity verification (as opposed to
  118. checking the CRC32 of the segment) of data, which means reading the data from the
  119. repository, decrypting and decompressing it. This is a cryptographic verification,
  120. which will detect (accidental) corruption. For encrypted repositories it is
  121. tamper\-resistant as well, unless the attacker has access to the keys. It is also very
  122. slow.
  123. .SH OPTIONS
  124. .sp
  125. See \fIborg\-common(1)\fP for common options of Borg commands.
  126. .SS arguments
  127. .INDENT 0.0
  128. .TP
  129. .B REPOSITORY_OR_ARCHIVE
  130. repository or archive to check consistency of
  131. .UNINDENT
  132. .SS optional arguments
  133. .INDENT 0.0
  134. .TP
  135. .B \-\-repository\-only
  136. only perform repository checks
  137. .TP
  138. .B \-\-archives\-only
  139. only perform archives checks
  140. .TP
  141. .B \-\-verify\-data
  142. perform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP)
  143. .TP
  144. .B \-\-repair
  145. attempt to repair any inconsistencies found
  146. .TP
  147. .B \-\-save\-space
  148. work slower, but using less space
  149. .TP
  150. .BI \-\-max\-duration \ SECONDS
  151. do only a partial repo check for max. SECONDS seconds (Default: unlimited)
  152. .UNINDENT
  153. .SS Archive filters
  154. .INDENT 0.0
  155. .TP
  156. .BI \-P \ PREFIX\fR,\fB \ \-\-prefix \ PREFIX
  157. only consider archive names starting with this prefix.
  158. .TP
  159. .BI \-a \ GLOB\fR,\fB \ \-\-glob\-archives \ GLOB
  160. 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.
  161. .TP
  162. .BI \-\-sort\-by \ KEYS
  163. Comma\-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp
  164. .TP
  165. .BI \-\-first \ N
  166. consider first N archives after other filters were applied
  167. .TP
  168. .BI \-\-last \ N
  169. consider last N archives after other filters were applied
  170. .UNINDENT
  171. .SH SEE ALSO
  172. .sp
  173. \fIborg\-common(1)\fP
  174. .SH AUTHOR
  175. The Borg Collective
  176. .\" Generated by docutils manpage writer.
  177. .