borg/docs/usage/recreate.rst
Thomas Waldmann df6f4201f8
docs: fix broken examples and stale output samples in the usage docs
All command lines were executed against scratch repositories and all
output samples regenerated from real runs (prettified, not invented):

- recreate: the example used the removed --recompress; show
  borg repo-compress instead; refresh the borg info samples.
- diff: default/text output has modified:/added:/removed: labels and
  mtime/ctime brackets now; the JSON-lines example used borg1 keys
  and lacked --json-lines on the command; add --content-only.
- mount: example passed the repository as a positional (it would have
  been taken as the mountpoint); use -r.
- tar: the archive-copy loop was a bash syntax error and used
  borg list with repo-list-only format keys; replaced with a working
  while-read loop over borg repo-list (verified end-to-end, identical
  archive contents in the destination repo).
- key: regenerate repo-create/change-passphrase samples (hex-id named
  keyfiles, Key location line, no "Synchronizing index"); the import
  example silently did nothing without --key-location=keyfile; fix
  the Windows keys path (AppData\Local, not Roaming); explain why the
  keyfile name changes on passphrase change.
- transfer: the borg1->borg2 upgrade steps were missing --from-borg1
  and used a ssh:// destination URL (rejected for current repos);
  fix the Windows keys path.
- notes: --noatime and --nobsdflags no longer exist (atime is opt-in
  via --atime); stray "|" removed.
- compact: segments wording removed.
- info/repo-info/repo-delete/list/find: output samples regenerated
  (new labels/order, UTC offsets, repo version line, prompt text;
  isomtime format and symlink size corrected in list).
- general: fix broken inline markup (stray backtick).
- serve: the authorized_keys forced command needs --rest (it is
  deliberately not client-suppliable); document the actual client
  argument allowlist including --backend.

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

37 lines
1.6 KiB
ReStructuredText

.. include:: recreate.rst.inc
Examples
~~~~~~~~
::
# Create a backup with fast, low compression
$ borg create archive files --compression lz4
# Then recompress the data already stored in the repository — this might take longer,
# but the backup has already completed, so there are no inconsistencies from a
# long-running backup job. Note that recompressing existing repository data is the
# job of "borg repo-compress", not of "borg recreate".
$ borg repo-compress --compression zlib,9 --stats
Recompression stats:
Packs: 2 total, 2 rewritten.
Objects: 5 total, 2 recompressed, 0 already had the desired compression, 3 kept as-is (recompression brings no gain).
Repository size: 301.59 kB before, 301.53 kB after, shrunk by 60 B.
# Remove unwanted files from all archives in a repository.
# Note the relative path for the --exclude option — archives only contain relative paths.
$ borg recreate --exclude home/icke/Pictures/drunk_photos
# Change the archive comment. Note that recreate writes a new archive,
# so the archive fingerprint changes.
$ borg create --comment "This is a comment" archivename files
$ borg info -a archivename
Archive name: archivename
Archive fingerprint: 6cfecdd4e963bbe150c08169407de0353a4c5f2f90221646a9ebb0ce9be2529a
Comment: This is a comment
...
$ borg recreate --comment "This is a better comment" -a archivename
$ borg info -a archivename
Archive name: archivename
Archive fingerprint: 259b5302a8de9c889fb4915fe5df128f6c22776966db2dc3c7d3c8e741bf45b6
Comment: This is a better comment
...