borg-recreate(1)
π borg-recreate(1) β the borg backup tool's glow-up page π
okay bestie, sit down, hydrate, and let's talk about re-creating archives. this is from the borg backup tool and it's lowkey one of the most powerful (and most "please read the whole page first") commands in the whole kit. β¨
πΈ Name
borg-recreate β Re-create archives. fr fr, that's the whole job. π
β SYNOPSIS
borg [common options] recreate [options] [REPOSITORY_OR_ARCHIVE]
[PATH...]
π¦ DESCRIPTION
Recreate the contents of existing archives. yes, existing ones. we're not making fresh ones here, we're doing a whole renovation episode. π
Recreate is a potentially dangerous operation and might lead to data loss (if used wrongly). BE VERY CAREFUL! π This is the yelling part of the page and it is yelling for a reason.
Important: Repository disk space is not freed until you run borg compact. like, the vibes are freed but the bytes are not. you have to actually ask. π§Ή
--exclude, --exclude-from, --exclude-if-present, --keep-exclude-tags and PATH have the exact same semantics as in "borg create", but they only check for files in the archives and not in the local file system. If PATHs are specified, the resulting archives will only contain files from these PATHs. so it's the same rules as borg create, it's just looking inside the archive instead of at your actual disk. π«Ά
Note that all paths in an archive are relative, therefore absolute patterns/paths will not match (--exclude, --exclude-from, PATHs). this one bites people constantly, no cap. π
--recompress allows one to change the compression of existing data in archives. Due to how Borg stores compressed size information this might display incorrect information for archives that were not recreated at the same time. There is no risk of data loss by this. so the numbers might lie a little but your data is fine, bestie. π
--chunker-params will re-chunk all files in the archive; this can be used to have upgraded Borg 0.xx or Attic archives deduplicate with Borg 1.x archives. glow-up for your ancient archives, love that for them. β
USE WITH CAUTION. Depending on the PATHs and patterns given, recreate can be used to permanently delete files from archives. When in doubt, use --dry-run --verbose --list to see how patterns/PATHs are interpreted. See list_item_flags in borg create for details. π
The archive being recreated is only removed after the operation completes. The archive that is built during the operation exists at the same time at "<ARCHIVE>.recreate". The new archive will have a different archive ID. so there's a little temporary twin hanging around while the work happens, which is honestly iconic of it. π
With --target the original archive is not replaced; instead, a new archive is created. π―
When rechunking (or recompressing), space usage can be substantial β expect at least the entire deduplicated size of the archives using the previous chunker (or compression) parameters. your disk is gonna feel it. plan accordingly. π
If you recently ran borg check --repair and it had to fix lost chunks with all-zero replacement chunks, please first run another backup for the same data and re-run borg check --repair afterwards to heal any archives that had lost chunks which are still generated from the input data. ok so if that happened, go back, back it up again, heal again, then come here. do the steps in order, babe. π©Ή
Important: running borg recreate to re-chunk will remove the chunks_healthy metadata of all items with replacement chunks, so healing will not be possible anymore after re-chunking (it is also unlikely it would ever work: due to the change of chunking parameters, the missing chunk likely will never be seen again even if you still have the data that produced it). that metadata is gone-gone. no take-backs. π
β¨ OPTIONS β¨
See borg-common(1) for common options of Borg commands. the shared stuff lives over there, go say hi. π«Ά
π arguments
REPOSITORY_OR_ARCHIVEβ repository or archive to recreate. pick your target, bestie. π―PATHβ paths to recreate; patterns are supported. β¨
π options
--listβ output verbose list of items (files, dirs, ...). the receipts. π§Ύ--filter STATUSCHARSβ only display items with the given status characters (listed inborg create --help). filter the feed to only the status chars you care about. π-n,--dry-runβ do not change anything. the rehearsal. use it. π-s,--statsβ print statistics at end. numbers at the finish line. π
π Include/Exclude options
-e PATTERN,--exclude PATTERNβ exclude paths matchingPATTERN. not invited, blocked, bye. π«--exclude-from EXCLUDEFILEβ read exclude patterns fromEXCLUDEFILE, one per line. a whole guest list of nope. π--pattern PATTERNβ include/exclude paths matchingPATTERN. π¦--patterns-from PATTERNFILEβ read include/exclude patterns fromPATTERNFILE, one per line. π--exclude-cachesβ exclude directories that contain aCACHEDIR.TAGfile (<http://www.bford.info/cachedir/spec.html>). cache dirs know what they are, they tagged themselves. π·οΈ--exclude-if-present NAMEβ exclude directories that are tagged by containing a filesystem object with the givenNAME. π--keep-exclude-tagsβ if tag objects are specified with--exclude-if-present, don't omit the tag objects themselves from the backup archive. keep the little tag, it's part of the lore. π
π Archive options
--target TARGETβ create a new archive with the nameARCHIVE, do not replace existing archive (only applies for a single archive). new archive, original stays untouched, untouched queen energy. β¨-c SECONDS,--checkpoint-interval SECONDSβ write checkpoint everySECONDSseconds (Default:1800). save points! β±οΈ--comment COMMENTβ add a comment text to the archive. π¨οΈ--timestamp TIMESTAMPβ manually specify the archive creation date/time (UTC,yyyy-mm-ddThh:mm:ssformat). alternatively, give a reference file/directory. you can literally hand it a whole file/dir as the reference. π°οΈ-C COMPRESSION,--compression COMPRESSIONβ select compression algorithm, see the output of the"borg help compression"command for details. π₯--recompress MODEβ recompress data chunks according toMODEand--compression. Possible modes areif-different: recompress if current compression is with a different compression algorithm (the level is not considered);always: recompress even if current compression is with the same compression algorithm (use this to change the compression level); andnever: do not recompress (use this option to explicitly prevent recompression). If noMODEis given,if-differentwill be used. Not passing--recompressis equivalent to"--recompress never". so:if-different,always, ornever. that's the menu. π½οΈ--chunker-params PARAMSβ rechunk using given chunker parameters (ALGO,CHUNK_MIN_EXP,CHUNK_MAX_EXP,HASH_MASK_BITS,HASH_WINDOW_SIZE) or default to use the chunker defaults. default: do not rechunk. πΈ
π EXAMPLES
# Make old (Attic/Borg 0.xx) archives deduplicate with Borg 1.x archives.
# Archives created with Borg 1.1+ and the default chunker params are skipped
# (archive ID stays the same).
$ borg recreate /mnt/backup --chunker-params default --progress
# Create a backup with low but fast compression.
$ borg create /mnt/backup::archive /some/files --compression lz4
# Then compress it β this might take longer, but the backup has already completed,
# so no inconsistencies from a long-running backup job.
$ borg recreate /mnt/backup::archive --recompress --compression zlib,9
# Remove unwanted files from all archives in a repository.
# Note the relative path for the --exclude option β archives only contain relative paths.
$ borg recreate /mnt/backup --exclude home/icke/Pictures/drunk_photos
# Change the archive comment.
$ borg create --comment "This is a comment" /mnt/backup::archivename ~
$ borg info /mnt/backup::archivename
Name: archivename
Fingerprint: ...
Comment: This is a comment
...
$ borg recreate --comment "This is a better comment" /mnt/backup::archivename
$ borg info /mnt/backup::archivename
Name: archivename
Fingerprint: ...
Comment: This is a better comment
...
that last one? changing your mind about a comment and then just... changing it? character development. we love to see it. π
π«Ά SEE ALSO
borg-common(1), borg-patterns(1), borg-placeholders(1), borg-compression(1)
all the besties. go read them too, iykyk. π
π Author
The Borg Collective
okay that's the whole page, bestie!! π this was borg-recreate(1) from the borg backup tool, page dated 2026-07-18, and yes the footer really does say borg-recreate(1) again because manpages love a little symmetry. now go run --dry-run --verbose --list first, please, i am begging. π
β¨
π¦ where this page comes from
- alpine 3.24: borgbackup-doc 1.4.5-r0 Β· BSD-3-Clause
- arch rolling: borg 1.4.5-1 Β· BSD
- ubuntu stonking: borgbackup 1.4.5-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms