compact.rst.inc 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_compact:
  3. borg compact
  4. ------------
  5. .. code-block:: none
  6. borg [common options] compact [options]
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+-----------------------+-----------------------------------------+
  10. | **options** |
  11. +-------------------------------------------------------+-----------------------+-----------------------------------------+
  12. | | ``-n``, ``--dry-run`` | do nothing |
  13. +-------------------------------------------------------+-----------------------+-----------------------------------------+
  14. | | ``-s``, ``--stats`` | print statistics (might be much slower) |
  15. +-------------------------------------------------------+-----------------------+-----------------------------------------+
  16. | .. class:: borg-common-opt-ref |
  17. | |
  18. | :ref:`common_options` |
  19. +-------------------------------------------------------+-----------------------+-----------------------------------------+
  20. .. raw:: html
  21. <script type='text/javascript'>
  22. $(document).ready(function () {
  23. $('.borg-options-table colgroup').remove();
  24. })
  25. </script>
  26. .. only:: latex
  27. options
  28. -n, --dry-run do nothing
  29. -s, --stats print statistics (might be much slower)
  30. :ref:`common_options`
  31. |
  32. Description
  33. ~~~~~~~~~~~
  34. Free repository space by deleting unused chunks.
  35. borg compact analyzes all existing archives to find out which repository
  36. objects are actually used (referenced). It then deletes all unused objects
  37. from the repository to free space.
  38. Unused objects may result from:
  39. - borg delete or prune usage
  40. - interrupted backups (maybe retry the backup first before running compact)
  41. - backup of source files that had an I/O error in the middle of their contents
  42. and that were skipped due to this
  43. - corruption of the repository (e.g. the archives directory having lost
  44. entries, see notes below)
  45. You usually don't want to run ``borg compact`` after every write operation, but
  46. either regularly (e.g. once a month, possibly together with ``borg check``) or
  47. when disk space needs to be freed.
  48. **Important:**
  49. After compacting it is no longer possible to use ``borg undelete`` to recover
  50. previously soft-deleted archives.
  51. ``borg compact`` might also delete data from archives that were "lost" due to
  52. archives directory corruption. Such archives could potentially be restored with
  53. ``borg check --find-lost-archives [--repair]``, which is slow. You therefore
  54. might not want to do that unless there are signs of lost archives (e.g. when
  55. seeing fatal errors when creating backups or when archives are missing in
  56. ``borg repo-list``).
  57. When giving the ``--stats`` option, borg will internally list all repository
  58. objects to determine their existence AND stored size. It will build a fresh
  59. chunks index from that information and cache it in the repository. For some
  60. types of repositories, this might be very slow. It will tell you the sum of
  61. stored object sizes, before and after compaction.
  62. Without ``--stats``, borg will rely on the cached chunks index to determine
  63. existing object IDs (but there is no stored size information in the index,
  64. thus it can't compute before/after compaction size statistics).