check.rst.inc 3.6 KB

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