check.rst.inc 3.7 KB

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