check.rst.inc 3.5 KB

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