2
0

check.rst.inc 3.6 KB

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