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