check.rst.inc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. .. _borg_check:
  2. borg check
  3. ----------
  4. ::
  5. usage: borg check [-h] [-v] [--show-rc] [--no-files-cache] [--umask M]
  6. [--remote-path PATH] [--repository-only] [--archives-only]
  7. [--repair] [--last N]
  8. [REPOSITORY_OR_ARCHIVE]
  9. Check repository consistency
  10. positional arguments:
  11. REPOSITORY_OR_ARCHIVE
  12. repository or archive to check consistency of
  13. optional arguments:
  14. -h, --help show this help message and exit
  15. -v, --verbose verbose output
  16. --show-rc show/log the return code (rc)
  17. --no-files-cache do not load/update the file metadata cache used to
  18. detect unchanged files
  19. --umask M set umask to M (local and remote, default: 63)
  20. --remote-path PATH set remote path to executable (default: "borg")
  21. --repository-only only perform repository checks
  22. --archives-only only perform archives checks
  23. --repair attempt to repair any inconsistencies found
  24. --last N only check last N archives (Default: all)
  25. Description
  26. ~~~~~~~~~~~
  27. The check command verifies the consistency of a repository and the corresponding archives.
  28. First, the underlying repository data files are checked:
  29. - For all segments the segment magic (header) is checked
  30. - For all objects stored in the segments, all metadata (e.g. crc and size) and
  31. all data is read. The read data is checked by size and CRC. Bit rot and other
  32. types of accidental damage can be detected this way.
  33. - If we are in repair mode and a integrity error is detected for a segment,
  34. we try to recover as many objects from the segment as possible.
  35. - In repair mode, it makes sure that the index is consistent with the data
  36. stored in the segments.
  37. - If you use a remote repo server via ssh:, the repo check is executed on the
  38. repo server without causing significant network traffic.
  39. - The repository check can be skipped using the --archives-only option.
  40. Second, the consistency and correctness of the archive metadata is verified:
  41. - Is the repo manifest present? If not, it is rebuilt from archive metadata
  42. chunks (this requires reading and decrypting of all metadata and data).
  43. - Check if archive metadata chunk is present. if not, remove archive from
  44. manifest.
  45. - For all files (items) in the archive, for all chunks referenced by these
  46. files, check if chunk is present (if not and we are in repair mode, replace
  47. it with a same-size chunk of zeros). This requires reading of archive and
  48. file metadata, but not data.
  49. - If we are in repair mode and we checked all the archives: delete orphaned
  50. chunks from the repo.
  51. - if you use a remote repo server via ssh:, the archive check is executed on
  52. the client machine (because if encryption is enabled, the checks will require
  53. decryption and this is always done client-side, because key access will be
  54. required).
  55. - The archive checks can be time consuming, they can be skipped using the
  56. --repository-only option.