check.rst.inc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_check:
  3. borg check
  4. ----------
  5. .. code-block:: none
  6. borg [common options] check [options] REPOSITORY_OR_ARCHIVE
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  10. | **positional arguments** |
  11. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  12. | | ``REPOSITORY_OR_ARCHIVE`` | repository or archive to check consistency of |
  13. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | **optional arguments** |
  15. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | | ``--repository-only`` | only perform repository checks |
  17. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | | ``--archives-only`` | only perform archives checks |
  19. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | | ``--verify-data`` | perform cryptographic archive data integrity verification (conflicts with ``--repository-only``) |
  21. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | | ``--repair`` | attempt to repair any inconsistencies found |
  23. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | | ``--save-space`` | work slower, but using less space |
  25. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | .. class:: borg-common-opt-ref |
  27. | |
  28. | :ref:`common_options` |
  29. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | **filters** |
  31. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | | ``-P``, ``--prefix`` | only consider archive names starting with this prefix. |
  33. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | | ``-a``, ``--glob-archives`` | only consider archive names matching the glob. sh: rules apply, see "borg help patterns". ``--prefix`` and ``--glob-archives`` are mutually exclusive. |
  35. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | | ``--sort-by`` | Comma-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp |
  37. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | | ``--first N`` | consider first N archives after other filters were applied |
  39. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | | ``--last N`` | consider last N archives after other filters were applied |
  41. +-------------------------------------------------------+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. .. raw:: html
  43. <script type='text/javascript'>
  44. $(document).ready(function () {
  45. $('.borg-options-table colgroup').remove();
  46. })
  47. </script>
  48. .. only:: latex
  49. REPOSITORY_OR_ARCHIVE
  50. repository or archive to check consistency of
  51. optional arguments
  52. --repository-only only perform repository checks
  53. --archives-only only perform archives checks
  54. --verify-data perform cryptographic archive data integrity verification (conflicts with ``--repository-only``)
  55. --repair attempt to repair any inconsistencies found
  56. --save-space work slower, but using less space
  57. :ref:`common_options`
  58. |
  59. filters
  60. -P, --prefix only consider archive names starting with this prefix.
  61. -a, --glob-archives only consider archive names matching the glob. sh: rules apply, see "borg help patterns". ``--prefix`` and ``--glob-archives`` are mutually exclusive.
  62. --sort-by Comma-separated list of sorting keys; valid keys are: timestamp, name, id; default is: timestamp
  63. --first N consider first N archives after other filters were applied
  64. --last N consider last N archives after other filters were applied
  65. Description
  66. ~~~~~~~~~~~
  67. The check command verifies the consistency of a repository and the corresponding archives.
  68. First, the underlying repository data files are checked:
  69. - For all segments the segment magic (header) is checked
  70. - For all objects stored in the segments, all metadata (e.g. crc and size) and
  71. all data is read. The read data is checked by size and CRC. Bit rot and other
  72. types of accidental damage can be detected this way.
  73. - If we are in repair mode and a integrity error is detected for a segment,
  74. we try to recover as many objects from the segment as possible.
  75. - In repair mode, it makes sure that the index is consistent with the data
  76. stored in the segments.
  77. - If you use a remote repo server via ssh:, the repo check is executed on the
  78. repo server without causing significant network traffic.
  79. - The repository check can be skipped using the ``--archives-only`` option.
  80. Second, the consistency and correctness of the archive metadata is verified:
  81. - Is the repo manifest present? If not, it is rebuilt from archive metadata
  82. chunks (this requires reading and decrypting of all metadata and data).
  83. - Check if archive metadata chunk is present. if not, remove archive from
  84. manifest.
  85. - For all files (items) in the archive, for all chunks referenced by these
  86. files, check if chunk is present.
  87. If a chunk is not present and we are in repair mode, replace it with a same-size
  88. replacement chunk of zeros.
  89. If a previously lost chunk reappears (e.g. via a later backup) and we are in
  90. repair mode, the all-zero replacement chunk will be replaced by the correct chunk.
  91. This requires reading of archive and file metadata, but not data.
  92. - If we are in repair mode and we checked all the archives: delete orphaned
  93. chunks from the repo.
  94. - if you use a remote repo server via ssh:, the archive check is executed on
  95. the client machine (because if encryption is enabled, the checks will require
  96. decryption and this is always done client-side, because key access will be
  97. required).
  98. - The archive checks can be time consuming, they can be skipped using the
  99. ``--repository-only`` option.
  100. The ``--verify-data`` option will perform a full integrity verification (as opposed to
  101. checking the CRC32 of the segment) of data, which means reading the data from the
  102. repository, decrypting and decompressing it. This is a cryptographic verification,
  103. which will detect (accidental) corruption. For encrypted repositories it is
  104. tamper-resistant as well, unless the attacker has access to the keys.
  105. It is also very slow.