borg-check.1 5.8 KB

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