check.rst.inc 3.3 KB

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