check.rst.inc 4.0 KB

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