borg-check.1 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH BORG-CHECK 1 "2021-05-11" "" "borg backup tool"
  4. .SH NAME
  5. borg-check \- Check repository consistency
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  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. First, the underlying repository data files are checked:
  44. .INDENT 0.0
  45. .IP \(bu 2
  46. For all segments, the segment magic header is checked.
  47. .IP \(bu 2
  48. For all objects stored in the segments, all metadata (e.g. CRC and size) and
  49. all data is read. The read data is checked by size and CRC. Bit rot and other
  50. types of accidental damage can be detected this way.
  51. .IP \(bu 2
  52. In repair mode, if an integrity error is detected in a segment, try to recover
  53. as many objects from the segment as possible.
  54. .IP \(bu 2
  55. In repair mode, make sure that the index is consistent with the data stored in
  56. the segments.
  57. .IP \(bu 2
  58. If checking a remote repo via \fBssh:\fP, the repo check is executed on the server
  59. without causing significant network traffic.
  60. .IP \(bu 2
  61. The repository check can be skipped using the \fB\-\-archives\-only\fP option.
  62. .IP \(bu 2
  63. A repository check can be time consuming. Partial checks are possible with the
  64. \fB\-\-max\-duration\fP option.
  65. .UNINDENT
  66. .sp
  67. Second, the consistency and correctness of the archive metadata is verified:
  68. .INDENT 0.0
  69. .IP \(bu 2
  70. Is the repo manifest present? If not, it is rebuilt from archive metadata
  71. chunks (this requires reading and decrypting of all metadata and data).
  72. .IP \(bu 2
  73. Check if archive metadata chunk is present; if not, remove archive from manifest.
  74. .IP \(bu 2
  75. For all files (items) in the archive, for all chunks referenced by these
  76. files, check if chunk is present. In repair mode, if a chunk is not present,
  77. replace it with a same\-size replacement chunk of zeroes. If a previously lost
  78. chunk reappears (e.g. via a later backup), in repair mode the all\-zero replacement
  79. chunk will be replaced by the correct chunk. This requires reading of archive and
  80. file metadata, but not data.
  81. .IP \(bu 2
  82. In repair mode, when all the archives were checked, orphaned chunks are deleted
  83. from the repo. One cause of orphaned chunks are input file related errors (like
  84. read errors) in the archive creation process.
  85. .IP \(bu 2
  86. If checking a remote repo via \fBssh:\fP, the archive check is executed on the
  87. client machine because it requires decryption, and this is always done client\-side
  88. as key access is needed.
  89. .IP \(bu 2
  90. The archive checks can be time consuming; they can be skipped using the
  91. \fB\-\-repository\-only\fP option.
  92. .UNINDENT
  93. .sp
  94. The \fB\-\-max\-duration\fP option can be used to split a long\-running repository check
  95. into multiple partial checks. After the given number of seconds the check is
  96. interrupted. The next partial check will continue where the previous one stopped,
  97. until the complete repository has been checked. Example: Assuming a full check took 7
  98. hours, then running a daily check with \-\-max\-duration=3600 (1 hour) resulted in one
  99. full check per week.
  100. .sp
  101. Attention: Partial checks can only do way less checking than a full check (only the
  102. CRC32 checks on segment file entries are done), and cannot be combined with the
  103. \fB\-\-repair\fP option. Partial checks may therefore be useful only with very large
  104. repositories where a full check took too long. Doing a full repository check aborts a
  105. partial check; the next partial check will restart from the beginning.
  106. .sp
  107. The \fB\-\-verify\-data\fP option will perform a full integrity verification (as opposed to
  108. checking the CRC32 of the segment) of data, which means reading the data from the
  109. repository, decrypting and decompressing it. This is a cryptographic verification,
  110. which will detect (accidental) corruption. For encrypted repositories it is
  111. tamper\-resistant as well, unless the attacker has access to the keys. It is also very
  112. slow.
  113. .SH OPTIONS
  114. .sp
  115. See \fIborg\-common(1)\fP for common options of Borg commands.
  116. .SS arguments
  117. .INDENT 0.0
  118. .TP
  119. .B REPOSITORY_OR_ARCHIVE
  120. repository or archive to check consistency of
  121. .UNINDENT
  122. .SS optional arguments
  123. .INDENT 0.0
  124. .TP
  125. .B \-\-repository\-only
  126. only perform repository checks
  127. .TP
  128. .B \-\-archives\-only
  129. only perform archives checks
  130. .TP
  131. .B \-\-verify\-data
  132. perform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP)
  133. .TP
  134. .B \-\-repair
  135. attempt to repair any inconsistencies found
  136. .TP
  137. .B \-\-save\-space
  138. work slower, but using less space
  139. .TP
  140. .BI \-\-max\-duration \ SECONDS
  141. do only a partial repo check for max. SECONDS seconds (Default: unlimited)
  142. .UNINDENT
  143. .SS Archive filters
  144. .INDENT 0.0
  145. .TP
  146. .BI \-P \ PREFIX\fR,\fB \ \-\-prefix \ PREFIX
  147. only consider archive names starting with this prefix.
  148. .TP
  149. .BI \-a \ GLOB\fR,\fB \ \-\-glob\-archives \ GLOB
  150. 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.
  151. .TP
  152. .BI \-\-sort\-by \ KEYS
  153. Comma\-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp
  154. .TP
  155. .BI \-\-first \ N
  156. consider first N archives after other filters were applied
  157. .TP
  158. .BI \-\-last \ N
  159. consider last N archives after other filters were applied
  160. .UNINDENT
  161. .SH SEE ALSO
  162. .sp
  163. \fIborg\-common(1)\fP
  164. .SH AUTHOR
  165. The Borg Collective
  166. .\" Generated by docutils manpage writer.
  167. .