2026-03-15 09:34:31 -04:00
. \" Man page generated from reStructuredText
. \" by the Docutils 0.22.4 manpage writer.
2017-02-05 08:22:06 -05:00
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\ $1 \\ n[an-margin]
level \\ n[rst2man-indent-level]
level margin: \\ n[rst2man-indent\\ n[rst2man-indent-level]]
-
\\ n[rst2man-indent0]
\\ n[rst2man-indent1]
\\ n[rst2man-indent2]
. .
.de1 INDENT
. \" .rstReportMargin pre:
. RS \\ $1
. nr rst2man-indent\\n[rst2man-indent-level] \\ n[an-margin]
. nr rst2man-indent-level +1
. \" .rstReportMargin post:
. .
.de UNINDENT
. RE
. \" indent \\n[an-margin]
. \" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
. \" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\ n[rst2man-indent\\n[rst2man-indent-level]]u
. .
2026-06-16 08:17:43 -04:00
.TH "borg-recreate" "1" "2026-06-16" "" "borg backup tool"
2026-03-15 09:34:31 -04:00
.SH Name
2025-12-23 12:00:09 -05:00
borg-recreate \- Recreate archives.
2017-02-05 08:22:06 -05:00
.SH SYNOPSIS
.sp
2022-06-23 19:19:19 -04:00
borg [common options] recreate [options] [PATH...]
2017-02-05 08:22:06 -05:00
.SH DESCRIPTION
.sp
Recreate the contents of existing archives.
.sp
2025-12-23 12:00:09 -05:00
Recreate is a potentially dangerous function and might lead to data loss
2020-10-04 14:33:08 -04:00
(if used wrongly). BE VERY CAREFUL!
2017-02-05 08:22:06 -05:00
.sp
2018-07-12 16:00:19 -04:00
Important: Repository disk space is \fB not\fP freed until you run \fB borg compact\fP \& .
.sp
2020-10-04 14:33:08 -04:00
\fB \- \- exclude\fP , \fB \- \- exclude\- from\fP , \fB \- \- exclude\- if\- present\fP , \fB \- \- keep\- exclude\- tags\fP
2022-09-10 10:03:27 -04:00
and PATH have the exact same semantics as in \(dq borg create\(dq , but they only check
2025-12-23 12:00:09 -05:00
files in the archives and not in the local filesystem. If paths are specified,
the resulting archives will contain only files from those paths.
2017-02-05 08:22:06 -05:00
.sp
Note that all paths in an archive are relative, therefore absolute patterns/paths
2017-06-18 06:13:28 -04:00
will \fI not\fP match (\fB \- \- exclude\fP , \fB \- \- exclude\- from\fP , PATHs).
2017-02-05 08:22:06 -05:00
.sp
2017-06-18 06:13:28 -04:00
\fB \- \- chunker\- params\fP will re\- chunk all files in the archive, this can be
2022-07-17 03:23:06 -04:00
used to have upgraded Borg 0.xx archives deduplicate with Borg 1.x archives.
2017-02-05 08:22:06 -05:00
.sp
2017-06-18 06:13:28 -04:00
\fB USE WITH CAUTION.\fP
2025-12-23 12:00:09 -05:00
Depending on the paths and patterns given, recreate can be used to
2022-12-29 17:26:54 -05:00
delete files from archives permanently.
2025-12-23 12:00:09 -05:00
When in doubt, use \fB \- \- dry\- run \- \- verbose \- \- list\fP to see how patterns/paths are
2020-10-04 14:33:08 -04:00
interpreted. See \fI list_item_flags\fP in \fB borg create\fP for details.
2017-02-05 08:22:06 -05:00
.sp
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
2022-09-10 10:03:27 -04:00
\(dq <ARCHIVE>.recreate\(dq . The new archive will have a different archive ID.
2017-02-05 08:22:06 -05:00
.sp
2017-06-18 06:13:28 -04:00
With \fB \- \- target\fP the original archive is not replaced, instead a new archive is created.
2017-02-05 08:22:06 -05:00
.sp
2024-02-20 11:12:43 -05:00
When rechunking, space usage can be substantial \- expect
2018-07-12 16:00:19 -04:00
at least the entire deduplicated size of the archives using the previous
2024-02-20 11:12:43 -05:00
chunker params.
2017-11-25 08:38:04 -05:00
.sp
2025-04-21 15:07:46 -04:00
If your most recent borg check found missing chunks, please first run another
backup for the same data, before doing any rechunking. If you are lucky, that
2025-12-23 12:00:09 -05:00
will recreate the missing chunks. Optionally, do another borg check to see
if the chunks are still missing.
2017-02-05 08:22:06 -05:00
.SH OPTIONS
.sp
See \fI borg\- common(1)\fP for common options of Borg commands.
.SS arguments
.INDENT 0 .0
.TP
.B PATH
paths to recreate; patterns are supported
.UNINDENT
2025-04-21 15:07:46 -04:00
.SS options
2017-02-05 08:22:06 -05:00
.INDENT 0 .0
.TP
2022-06-23 19:19:19 -04:00
.B \- \- list
2017-02-05 08:22:06 -05:00
output verbose list of items (files, dirs, ...)
.TP
.BI \- \- filter \ STATUSCHARS
2017-11-25 08:38:04 -05:00
only display items with the given status characters (listed in borg create \- \- help)
2017-02-05 08:22:06 -05:00
.TP
2022-06-23 19:19:19 -04:00
.B \- n\fP,\fB \- \- dry\-run
2017-02-05 08:22:06 -05:00
do not change anything
.TP
2022-06-23 19:19:19 -04:00
.B \- s\fP,\fB \- \- stats
2017-02-05 08:22:06 -05:00
print statistics at end
.UNINDENT
2023-06-11 17:10:23 -04:00
.SS Include/Exclude options
2017-02-05 08:22:06 -05:00
.INDENT 0 .0
.TP
2020-10-04 14:33:08 -04:00
.BI \- e \ PATTERN\fR,\fB \ \- \- exclude \ PATTERN
2017-02-05 08:22:06 -05:00
exclude paths matching PATTERN
.TP
.BI \- \- exclude\-from \ EXCLUDEFILE
read exclude patterns from EXCLUDEFILE, one per line
.TP
2017-11-25 08:38:04 -05:00
.BI \- \- pattern \ PATTERN
2022-02-05 11:30:40 -05:00
include/exclude paths matching PATTERN
2017-11-25 08:38:04 -05:00
.TP
.BI \- \- patterns\-from \ PATTERNFILE
2022-02-05 11:30:40 -05:00
read include/exclude patterns from PATTERNFILE, one per line
2017-11-25 08:38:04 -05:00
.TP
2022-06-23 19:19:19 -04:00
.B \- \- exclude\-caches
2026-03-15 09:34:31 -04:00
exclude directories that contain a CACHEDIR.TAG file (\% <https://\: www\: .bford\: .info/\: cachedir/\: spec\: .html>)
2017-02-05 08:22:06 -05:00
.TP
.BI \- \- exclude\-if\-present \ NAME
2017-03-26 19:58:19 -04:00
exclude directories that are tagged by containing a filesystem object with the given NAME
2017-02-05 08:22:06 -05:00
.TP
2022-06-23 19:19:19 -04:00
.B \- \- keep\-exclude\-tags
2025-12-23 12:00:09 -05:00
if tag objects are specified with \fB \- \- exclude\- if\- present\fP , do not omit the tag objects themselves from the backup archive
2017-02-05 08:22:06 -05:00
.UNINDENT
2022-06-23 19:19:19 -04:00
.SS Archive filters
2017-02-05 08:22:06 -05:00
.INDENT 0 .0
.TP
2022-10-02 09:51:17 -04:00
.BI \- a \ PATTERN\fR,\fB \ \- \- match\-archives \ PATTERN
2025-12-23 12:00:09 -05:00
only consider archives matching all patterns. See \(dq borg help match\- archives\(dq .
2022-06-23 19:19:19 -04:00
.TP
.BI \- \- sort\-by \ KEYS
2024-10-03 06:23:03 -04:00
Comma\- separated list of sorting keys; valid keys are: timestamp, archive, name, id, tags, host, user; default is: timestamp
2022-06-23 19:19:19 -04:00
.TP
.BI \- \- first \ N
2025-12-23 12:00:09 -05:00
consider the first N archives after other filters are applied
2022-06-23 19:19:19 -04:00
.TP
.BI \- \- last \ N
2025-12-23 12:00:09 -05:00
consider the last N archives after other filters are applied
2022-06-23 19:19:19 -04:00
.TP
2023-02-26 15:30:54 -05:00
.BI \- \- oldest \ TIMESPAN
2025-12-23 12:00:09 -05:00
consider archives between the oldest archive\(aq s timestamp and (oldest + TIMESPAN), e.g., 7d or 12m.
2023-02-26 15:30:54 -05:00
.TP
.BI \- \- newest \ TIMESPAN
2025-12-23 12:00:09 -05:00
consider archives between the newest archive\(aq s timestamp and (newest \- TIMESPAN), e.g., 7d or 12m.
2023-02-26 15:30:54 -05:00
.TP
.BI \- \- older \ TIMESPAN
2025-12-23 12:00:09 -05:00
consider archives older than (now \- TIMESPAN), e.g., 7d or 12m.
2023-02-26 15:30:54 -05:00
.TP
.BI \- \- newer \ TIMESPAN
2025-12-23 12:00:09 -05:00
consider archives newer than (now \- TIMESPAN), e.g., 7d or 12m.
2023-02-26 15:30:54 -05:00
.TP
2017-02-05 08:22:06 -05:00
.BI \- \- target \ TARGET
2024-09-26 01:57:01 -04:00
create a new archive with the name ARCHIVE, do not replace existing archive
2017-02-05 08:22:06 -05:00
.TP
.BI \- \- comment \ COMMENT
add a comment text to the archive
.TP
.BI \- \- timestamp \ TIMESTAMP
2022-09-10 10:03:27 -04:00
manually specify the archive creation date/time (yyyy\- mm\- ddThh:mm:ss[(+|\- )HH:MM] format, (+|\- )HH:MM is the UTC offset, default: local time zone). Alternatively, give a reference file/directory.
2017-02-05 08:22:06 -05:00
.TP
2020-10-04 14:33:08 -04:00
.BI \- C \ COMPRESSION\fR,\fB \ \- \- compression \ COMPRESSION
2022-09-10 10:03:27 -04:00
select compression algorithm, see the output of the \(dq borg help compression\(dq command for details.
2017-02-05 08:22:06 -05:00
.TP
.BI \- \- chunker\-params \ PARAMS
2023-02-26 15:30:54 -05:00
rechunk using given chunker parameters (ALGO, CHUNK_MIN_EXP, CHUNK_MAX_EXP, HASH_MASK_BITS, HASH_WINDOW_SIZE) or \fI default\fP to use the chunker defaults. default: do not rechunk
2017-02-05 08:22:06 -05:00
.UNINDENT
.SH EXAMPLES
.INDENT 0 .0
.INDENT 3 .5
.sp
2025-04-21 15:07:46 -04:00
.EX
2025-12-23 12:00:09 -05:00
# Create a backup with fast, low compression
2022-06-23 19:19:19 -04:00
$ borg create archive /some/files \- \- compression lz4
2025-12-23 12:00:09 -05:00
# Then recompress it — this might take longer, but the backup has already completed,
# so there are no inconsistencies from a long\- running backup job.
2022-06-23 19:19:19 -04:00
$ borg recreate \- a archive \- \- recompress \- \- compression zlib,9
2017-02-05 08:22:06 -05:00
2017-11-25 08:38:04 -05:00
# Remove unwanted files from all archives in a repository.
2025-12-23 12:00:09 -05:00
# Note the relative path for the \- \- exclude option — archives only contain relative paths.
2022-06-23 19:19:19 -04:00
$ borg recreate \- \- exclude home/icke/Pictures/drunk_photos
2017-02-05 08:22:06 -05:00
2025-12-23 12:00:09 -05:00
# Change the archive comment
2022-09-10 10:03:27 -04:00
$ borg create \- \- comment \(dq This is a comment\(dq archivename ~
2022-06-23 19:19:19 -04:00
$ borg info \- a archivename
2017-02-05 08:22:06 -05:00
Name: archivename
Fingerprint: ...
Comment: This is a comment
\& ...
2022-09-10 10:03:27 -04:00
$ borg recreate \- \- comment \(dq This is a better comment\(dq \- a archivename
2022-06-23 19:19:19 -04:00
$ borg info \- a archivename
2017-02-05 08:22:06 -05:00
Name: archivename
Fingerprint: ...
Comment: This is a better comment
\& ...
2025-04-21 15:07:46 -04:00
.EE
2017-02-05 08:22:06 -05:00
.UNINDENT
.UNINDENT
.SH SEE ALSO
.sp
\fI borg\- common(1)\fP , \fI borg\- patterns(1)\fP , \fI borg\- placeholders(1)\fP , \fI borg\- compression(1)\fP
2026-03-15 09:34:31 -04:00
.SH Author
2017-02-05 08:22:06 -05:00
The Borg Collective
2026-03-15 09:34:31 -04:00
. \" End of generated man page.