check.rst.inc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. .. _borg_check:
  2. borg check
  3. ----------
  4. ::
  5. borg check <options> REPOSITORY_OR_ARCHIVE
  6. positional arguments
  7. REPOSITORY_OR_ARCHIVE
  8. repository or archive to check consistency of
  9. optional arguments
  10. ``--repository-only``
  11. | only perform repository checks
  12. ``--archives-only``
  13. | only perform archives checks
  14. ``--repair``
  15. | attempt to repair any inconsistencies found
  16. ``--save-space``
  17. | work slower, but using less space
  18. ``--last N``
  19. | only check last N archives (Default: all)
  20. ``-P``, ``--prefix``
  21. | only consider archive names starting with this prefix
  22. `Common options`_
  23. |
  24. Description
  25. ~~~~~~~~~~~
  26. The check command verifies the consistency of a repository and the corresponding archives.
  27. First, the underlying repository data files are checked:
  28. - For all segments the segment magic (header) is checked
  29. - For all objects stored in the segments, all metadata (e.g. crc and size) and
  30. all data is read. The read data is checked by size and CRC. Bit rot and other
  31. types of accidental damage can be detected this way.
  32. - If we are in repair mode and a integrity error is detected for a segment,
  33. we try to recover as many objects from the segment as possible.
  34. - In repair mode, it makes sure that the index is consistent with the data
  35. stored in the segments.
  36. - If you use a remote repo server via ssh:, the repo check is executed on the
  37. repo server without causing significant network traffic.
  38. - The repository check can be skipped using the --archives-only option.
  39. Second, the consistency and correctness of the archive metadata is verified:
  40. - Is the repo manifest present? If not, it is rebuilt from archive metadata
  41. chunks (this requires reading and decrypting of all metadata and data).
  42. - Check if archive metadata chunk is present. if not, remove archive from
  43. manifest.
  44. - For all files (items) in the archive, for all chunks referenced by these
  45. files, check if chunk is present (if not and we are in repair mode, replace
  46. it with a same-size chunk of zeros). This requires reading of archive and
  47. file metadata, but not data.
  48. - If we are in repair mode and we checked all the archives: delete orphaned
  49. chunks from the repo.
  50. - if you use a remote repo server via ssh:, the archive check is executed on
  51. the client machine (because if encryption is enabled, the checks will require
  52. decryption and this is always done client-side, because key access will be
  53. required).
  54. - The archive checks can be time consuming, they can be skipped using the
  55. --repository-only option.