borg-check.1 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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" "2025-05-22" "" "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 <ssh://> remote repository, please note that the checks run on
  48. the 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 scan for archives whose
  55. entries were lost from the archive directory, pass \fB\-\-find\-lost\-archives\fP\&.
  56. It requires reading all data and is hence very time consuming.
  57. To additionally cryptographically verify the file (content) data integrity,
  58. pass \fB\-\-verify\-data\fP, which is even more time consuming.
  59. .sp
  60. When checking archives of a remote repository, archive checks run on the client
  61. machine because they require decrypting data and therefore the encryption key.
  62. .UNINDENT
  63. .sp
  64. Both steps can also be run independently. Pass \fB\-\-repository\-only\fP to run the
  65. repository checks only, or pass \fB\-\-archives\-only\fP to run the archive checks
  66. only.
  67. .sp
  68. The \fB\-\-max\-duration\fP option can be used to split a long\-running repository
  69. check into multiple partial checks. After the given number of seconds the check
  70. is interrupted. The next partial check will continue where the previous one
  71. stopped, until the full repository has been checked. Assuming a complete check
  72. would take 7 hours, then running a daily check with \fB\-\-max\-duration=3600\fP
  73. (1 hour) would result in one full repository check per week. Doing a full
  74. repository check aborts any previous partial check; the next partial check will
  75. restart from the beginning. With partial repository checks you can run neither
  76. archive checks, nor enable repair mode. Consequently, if you want to use
  77. \fB\-\-max\-duration\fP you must also pass \fB\-\-repository\-only\fP, and must not pass
  78. \fB\-\-archives\-only\fP, nor \fB\-\-repair\fP\&.
  79. .sp
  80. \fBWarning:\fP Please note that partial repository checks (i.e. running it with
  81. \fB\-\-max\-duration\fP) can only perform non\-cryptographic checksum checks on the
  82. repository files. Enabling partial repository checks excepts archive checks
  83. for the same reason. Therefore partial checks may be useful with very large
  84. repositories only where a full check would take too long.
  85. .sp
  86. The \fB\-\-verify\-data\fP option will perform a full integrity verification (as
  87. opposed to checking just the xxh64) of data, which means reading the
  88. data from the repository, decrypting and decompressing it. It is a complete
  89. cryptographic verification and hence very time consuming, but will detect any
  90. accidental and malicious corruption. Tamper\-resistance is only guaranteed for
  91. encrypted repositories against attackers without access to the keys. You can
  92. not use \fB\-\-verify\-data\fP with \fB\-\-repository\-only\fP\&.
  93. .sp
  94. The \fB\-\-find\-lost\-archives\fP option will also scan the whole repository, but
  95. tells Borg to search for lost archive metadata. If Borg encounters any archive
  96. metadata that doesn\(aqt match with an archive directory entry (including
  97. soft\-deleted archives), it means that an entry was lost.
  98. Unless \fBborg compact\fP is called, these archives can be fully restored with
  99. \fB\-\-repair\fP\&. Please note that \fB\-\-find\-lost\-archives\fP must read a lot of
  100. data from the repository and is thus very time consuming. You can not use
  101. \fB\-\-find\-lost\-archives\fP with \fB\-\-repository\-only\fP\&.
  102. .SS About repair mode
  103. .sp
  104. The check command is a readonly task by default. If any corruption is found,
  105. Borg will report the issue and proceed with checking. To actually repair the
  106. issues found, pass \fB\-\-repair\fP\&.
  107. .sp
  108. \fBNOTE:\fP
  109. .INDENT 0.0
  110. .INDENT 3.5
  111. \fB\-\-repair\fP is a \fBPOTENTIALLY DANGEROUS FEATURE\fP and might lead to data
  112. loss! This does not just include data that was previously lost anyway, but
  113. might include more data for kinds of corruption it is not capable of
  114. dealing with. \fBBE VERY CAREFUL!\fP
  115. .UNINDENT
  116. .UNINDENT
  117. .sp
  118. Pursuant to the previous warning it is also highly recommended to test the
  119. reliability of the hardware running Borg with stress testing software. This
  120. especially includes storage and memory testers. Unreliable hardware might lead
  121. to additional data loss.
  122. .sp
  123. It is highly recommended to create a backup of your repository before running
  124. in repair mode (i.e. running it with \fB\-\-repair\fP).
  125. .sp
  126. Repair mode will attempt to fix any corruptions found. Fixing corruptions does
  127. not mean recovering lost data: Borg can not magically restore data lost due to
  128. e.g. a hardware failure. Repairing a repository means sacrificing some data
  129. for the sake of the repository as a whole and the remaining data. Hence it is,
  130. by definition, a potentially lossy task.
  131. .sp
  132. In practice, repair mode hooks into both the repository and archive checks:
  133. .INDENT 0.0
  134. .IP 1. 3
  135. When checking the repository\(aqs consistency, repair mode removes corrupted
  136. objects from the repository after it did a 2nd try to read them correctly.
  137. .IP 2. 3
  138. When checking the consistency and correctness of archives, repair mode might
  139. remove whole archives from the manifest if their archive metadata chunk is
  140. corrupt or lost. Borg will also report files that reference missing chunks.
  141. .UNINDENT
  142. .sp
  143. If \fB\-\-repair \-\-find\-lost\-archives\fP is given, previously lost entries will
  144. be recreated in the archive directory. This is only possible before
  145. \fBborg compact\fP would remove the archives\(aq data completely.
  146. .SH OPTIONS
  147. .sp
  148. See \fIborg\-common(1)\fP for common options of Borg commands.
  149. .SS options
  150. .INDENT 0.0
  151. .TP
  152. .B \-\-repository\-only
  153. only perform repository checks
  154. .TP
  155. .B \-\-archives\-only
  156. only perform archives checks
  157. .TP
  158. .B \-\-verify\-data
  159. perform cryptographic archive data integrity verification (conflicts with \fB\-\-repository\-only\fP)
  160. .TP
  161. .B \-\-repair
  162. attempt to repair any inconsistencies found
  163. .TP
  164. .B \-\-find\-lost\-archives
  165. attempt to find lost archives
  166. .TP
  167. .BI \-\-max\-duration \ SECONDS
  168. do only a partial repo check for max. SECONDS seconds (Default: unlimited)
  169. .UNINDENT
  170. .SS Archive filters
  171. .INDENT 0.0
  172. .TP
  173. .BI \-a \ PATTERN\fR,\fB \ \-\-match\-archives \ PATTERN
  174. only consider archives matching all patterns. see \(dqborg help match\-archives\(dq.
  175. .TP
  176. .BI \-\-sort\-by \ KEYS
  177. Comma\-separated list of sorting keys; valid keys are: timestamp, archive, name, id, tags, host, user; default is: timestamp
  178. .TP
  179. .BI \-\-first \ N
  180. consider first N archives after other filters were applied
  181. .TP
  182. .BI \-\-last \ N
  183. consider last N archives after other filters were applied
  184. .TP
  185. .BI \-\-oldest \ TIMESPAN
  186. consider archives between the oldest archive\(aqs timestamp and (oldest + TIMESPAN), e.g. 7d or 12m.
  187. .TP
  188. .BI \-\-newest \ TIMESPAN
  189. consider archives between the newest archive\(aqs timestamp and (newest \- TIMESPAN), e.g. 7d or 12m.
  190. .TP
  191. .BI \-\-older \ TIMESPAN
  192. consider archives older than (now \- TIMESPAN), e.g. 7d or 12m.
  193. .TP
  194. .BI \-\-newer \ TIMESPAN
  195. consider archives newer than (now \- TIMESPAN), e.g. 7d or 12m.
  196. .UNINDENT
  197. .SH SEE ALSO
  198. .sp
  199. \fIborg\-common(1)\fP
  200. .SH AUTHOR
  201. The Borg Collective
  202. .\" Generated by docutils manpage writer.
  203. .