2
0

check.rst.inc 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_check:
  3. borg check
  4. ----------
  5. ::
  6. borg check <options> REPOSITORY_OR_ARCHIVE
  7. positional arguments
  8. REPOSITORY_OR_ARCHIVE
  9. repository or archive to check consistency of
  10. optional arguments
  11. ``--repository-only``
  12. | only perform repository checks
  13. ``--archives-only``
  14. | only perform archives checks
  15. ``--verify-data``
  16. | perform cryptographic archive data integrity verification (conflicts with --repository-only)
  17. ``--repair``
  18. | attempt to repair any inconsistencies found
  19. ``--save-space``
  20. | work slower, but using less space
  21. ``-p``, ``--progress``
  22. | show progress display while checking
  23. `Common options`_
  24. |
  25. filters
  26. ``-P``, ``--prefix``
  27. | only consider archive names starting with this prefix
  28. ``--sort-by``
  29. | Comma-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp
  30. ``--first N``
  31. | consider first N archives after other filters were applied
  32. ``--last N``
  33. | consider last N archives after other filters were applied
  34. Description
  35. ~~~~~~~~~~~
  36. The check command verifies the consistency of a repository and the corresponding archives.
  37. First, the underlying repository data files are checked:
  38. - For all segments the segment magic (header) is checked
  39. - For all objects stored in the segments, all metadata (e.g. crc and size) and
  40. all data is read. The read data is checked by size and CRC. Bit rot and other
  41. types of accidental damage can be detected this way.
  42. - If we are in repair mode and a integrity error is detected for a segment,
  43. we try to recover as many objects from the segment as possible.
  44. - In repair mode, it makes sure that the index is consistent with the data
  45. stored in the segments.
  46. - If you use a remote repo server via ssh:, the repo check is executed on the
  47. repo server without causing significant network traffic.
  48. - The repository check can be skipped using the --archives-only option.
  49. Second, the consistency and correctness of the archive metadata is verified:
  50. - Is the repo manifest present? If not, it is rebuilt from archive metadata
  51. chunks (this requires reading and decrypting of all metadata and data).
  52. - Check if archive metadata chunk is present. if not, remove archive from
  53. manifest.
  54. - For all files (items) in the archive, for all chunks referenced by these
  55. files, check if chunk is present.
  56. If a chunk is not present and we are in repair mode, replace it with a same-size
  57. replacement chunk of zeros.
  58. If a previously lost chunk reappears (e.g. via a later backup) and we are in
  59. repair mode, the all-zero replacement chunk will be replaced by the correct chunk.
  60. This requires reading of archive and file metadata, but not data.
  61. - If we are in repair mode and we checked all the archives: delete orphaned
  62. chunks from the repo.
  63. - if you use a remote repo server via ssh:, the archive check is executed on
  64. the client machine (because if encryption is enabled, the checks will require
  65. decryption and this is always done client-side, because key access will be
  66. required).
  67. - The archive checks can be time consuming, they can be skipped using the
  68. --repository-only option.
  69. The --verify-data option will perform a full integrity verification (as opposed to
  70. checking the CRC32 of the segment) of data, which means reading the data from the
  71. repository, decrypting and decompressing it. This is a cryptographic verification,
  72. which will detect (accidental) corruption. For encrypted repositories it is
  73. tamper-resistant as well, unless the attacker has access to the keys.
  74. It is also very slow.