borg/docs/usage/repo-compress.rst
Thomas Waldmann 637972f363
re-add repo-compress, fixes #9663
reimplemented for the pack-based repository format: the repository is
processed pack after pack - each pack is read as a whole and, if it has
objects not stored with the desired compression, those get recompressed
and the pack is rewritten (objects already fine are copied into the new
pack unchanged), the chunk index is updated and the old pack is deleted.
a pack whose objects all already match is not touched at all.

- new Repository.transform_pack: rewrite one pack, passing each indexed
  object's bytes through a transform callback. gap bytes are handled
  like in compact_pack: superseded duplicates are dropped, other
  unindexed bytes are carried forward for "borg check --repair".
- factored the check_pack_objects / superseded_gap_ranges helpers out
  of compact_pack, now shared with merge_packs and transform_pack.
- crash safety like compact (#9748): stored chunk indexes are
  invalidated before the first store change, a full updated index is
  written back at the end. SIGINT stops cleanly at a pack boundary,
  saving a valid index; a later run recompresses the remaining packs.
- --stats reports rewritten packs, per-object outcomes (recompressed /
  already had the desired compression / kept as-is because
  recompression brings no gain) and the repository size change.
- re-adding the fish completions also restores the compression_methods
  definition that the create/transfer/recreate/import-tar completions
  kept referencing after it was removed together with the old
  repo-compress.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 10:12:06 +02:00

12 lines
274 B
ReStructuredText

.. include:: repo-compress.rst.inc
Examples
~~~~~~~~
::
# Recompress repository contents
$ borg repo-compress --progress --compression=zstd,3
# Recompress and obfuscate repository contents
$ borg repo-compress --progress --compression=obfuscate,1,zstd,3