| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 | .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!.. _borg_compact:borg compact------------.. code-block:: none    borg [common options] compact [options].. only:: html    .. class:: borg-options-table    +-------------------------------------------------------+-----------------------+-----------------------------------------+    | **options**                                                                                                             |    +-------------------------------------------------------+-----------------------+-----------------------------------------+    |                                                       | ``-n``, ``--dry-run`` | do nothing                              |    +-------------------------------------------------------+-----------------------+-----------------------------------------+    |                                                       | ``-s``, ``--stats``   | print statistics (might be much slower) |    +-------------------------------------------------------+-----------------------+-----------------------------------------+    | .. class:: borg-common-opt-ref                                                                                          |    |                                                                                                                         |    | :ref:`common_options`                                                                                                   |    +-------------------------------------------------------+-----------------------+-----------------------------------------+    .. raw:: html        <script type='text/javascript'>        $(document).ready(function () {            $('.borg-options-table colgroup').remove();        })        </script>.. only:: latex    options        -n, --dry-run    do nothing        -s, --stats     print statistics (might be much slower)    :ref:`common_options`        |Description~~~~~~~~~~~Free repository space by deleting unused chunks.borg compact analyzes all existing archives to find out which repositoryobjects are actually used (referenced). It then deletes all unused objectsfrom the repository to free space.Unused objects may result from:- borg delete or prune usage- interrupted backups (maybe retry the backup first before running compact)- backup of source files that had an I/O error in the middle of their contents  and that were skipped due to this- corruption of the repository (e.g. the archives directory having lost  entries, see notes below)You usually don't want to run ``borg compact`` after every write operation, buteither regularly (e.g. once a month, possibly together with ``borg check``) orwhen disk space needs to be freed.**Important:**After compacting it is no longer possible to use ``borg undelete`` to recoverpreviously soft-deleted archives.``borg compact`` might also delete data from archives that were "lost" due toarchives directory corruption. Such archives could potentially be restored with``borg check --find-lost-archives [--repair]``, which is slow. You thereforemight not want to do that unless there are signs of lost archives (e.g. whenseeing fatal errors when creating backups or when archives are missing in``borg repo-list``).When giving the ``--stats`` option, borg will internally list all repositoryobjects to determine their existence AND stored size. It will build a freshchunks index from that information and cache it in the repository. For sometypes of repositories, this might be very slow. It will tell you the sum ofstored object sizes, before and after compaction.Without ``--stats``, borg will rely on the cached chunks index to determineexisting object IDs (but there is no stored size information in the index,thus it can't compute before/after compaction size statistics).
 |