compact.rst.inc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 not change the repository |
  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 not change the repository
  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 determine 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. - use of ``borg delete`` or ``borg prune``
  40. - interrupted backups (consider retrying the backup before running compact)
  41. - backups of source files that encountered an I/O error mid-transfer and were skipped
  42. - corruption of the repository (e.g., the archives directory lost entries; see notes below)
  43. You usually do not want to run ``borg compact`` after every write operation, but
  44. either regularly (e.g., once a month, possibly together with ``borg check``) or
  45. when disk space needs to be freed.
  46. **Important:**
  47. After compacting, it is no longer possible to use ``borg undelete`` to recover
  48. previously soft-deleted archives.
  49. ``borg compact`` might also delete data from archives that were "lost" due to
  50. archives directory corruption. Such archives could potentially be restored with
  51. ``borg check --find-lost-archives [--repair]``, which is slow. You therefore
  52. might not want to do that unless there are signs of lost archives (e.g., when
  53. seeing fatal errors when creating backups or when archives are missing in
  54. ``borg repo-list``).
  55. When using the ``--stats`` option, borg will internally list all repository
  56. objects to determine their existence and stored size. It will build a fresh
  57. chunks index from that information and cache it in the repository. For some
  58. types of repositories, this might be very slow. It will tell you the sum of
  59. stored object sizes, before and after compaction.
  60. Without ``--stats``, borg will rely on the cached chunks index to determine
  61. existing object IDs (but there is no stored size information in the index,
  62. thus it cannot compute before/after compaction size statistics).