2026-03-15 09:34:31 -04:00
. \" Man page generated from reStructuredText
. \" by the Docutils 0.22.4 manpage writer.
2022-06-23 19:19:19 -04: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-transfer" "1" "2026-06-16" "" "borg backup tool"
2026-03-15 09:34:31 -04:00
.SH Name
2022-07-03 19:21:50 -04:00
borg-transfer \- archives transfer from other repository, optionally upgrade data format
2022-06-23 19:19:19 -04:00
.SH SYNOPSIS
.sp
borg [common options] transfer [options]
.SH DESCRIPTION
.sp
This command transfers archives from one repository to another repository.
2022-07-03 19:21:50 -04:00
Optionally, it can also upgrade the transferred data.
2023-06-11 17:10:23 -04:00
Optionally, it can also recompress the transferred data.
2025-05-19 17:20:38 -04:00
Optionally, it can also re\- chunk the transferred data using different chunker parameters.
2023-06-11 17:10:23 -04:00
.sp
It is easiest (and fastest) to give \fB \- \- compression=COMPRESSION \- \- recompress=never\fP using
the same COMPRESSION mode as in the SRC_REPO \- borg will use that COMPRESSION for metadata (in
any case) and keep data compressed \(dq as is\(dq (saves time as no data compression is needed).
.sp
If you want to globally change compression while transferring archives to the DST_REPO,
give \fB \- \- compress=WANTED_COMPRESSION \- \- recompress=always\fP \& .
2022-06-23 19:19:19 -04:00
.sp
2024-09-07 16:31:48 -04:00
The default is to transfer all archives.
.sp
You could use the misc. archive filter options to limit which archives it will
transfer, e.g. using the \fB \- a\fP option. This is recommended for big
repositories with multiple data sets to keep the runtime per invocation lower.
.SS General purpose archive transfer
.sp
Transfer borg2 archives into a related other borg2 repository:
2022-06-23 19:19:19 -04:00
.INDENT 0 .0
.INDENT 3 .5
.sp
2025-04-21 15:07:46 -04:00
.EX
2022-08-03 16:19:12 -04:00
# create a related DST_REPO (reusing key material from SRC_REPO), so that
2022-06-23 19:19:19 -04:00
# chunking and chunk id generation will work in the same way as before.
2024-09-08 11:52:10 -04:00
borg \- \- repo=DST_REPO repo\- create \- \- encryption=DST_ENC \- \- other\- repo=SRC_REPO
2022-06-23 19:19:19 -04:00
# transfer archives from SRC_REPO to DST_REPO
borg \- \- repo=DST_REPO transfer \- \- other\- repo=SRC_REPO \- \- dry\- run # check what it would do
borg \- \- repo=DST_REPO transfer \- \- other\- repo=SRC_REPO # do it!
borg \- \- repo=DST_REPO transfer \- \- other\- repo=SRC_REPO \- \- dry\- run # check! anything left?
2025-04-21 15:07:46 -04:00
.EE
2022-06-23 19:19:19 -04:00
.UNINDENT
.UNINDENT
2026-06-16 08:17:43 -04:00
.SS Data migration / upgrade from Borg 1 .x
2022-06-23 19:19:19 -04:00
.sp
2026-06-16 08:17:43 -04:00
To migrate your Borg 1.x archives into a related, new Borg 2 repository, usage is quite similar
2024-09-07 16:31:48 -04:00
to the above, but you need the \fB \- \- from\- borg1\fP option:
2022-07-03 19:21:50 -04:00
.INDENT 0 .0
.INDENT 3 .5
.sp
2025-04-21 15:07:46 -04:00
.EX
2026-06-16 08:17:43 -04:00
borg \- \- repo=DST_REPO repo\- create \- \- encryption=DST_ENC \- \- other\- repo=SRC_REPO \- \- from\- borg1
2024-09-07 16:31:48 -04:00
# to continue using lz4 compression as you did in SRC_REPO:
borg \- \- repo=DST_REPO transfer \- \- other\- repo=SRC_REPO \- \- from\- borg1 \e
\- \- compress=lz4 \- \- recompress=never
2023-06-11 17:10:23 -04:00
2024-09-07 16:31:48 -04:00
# alternatively, to recompress everything to zstd,3:
borg \- \- repo=DST_REPO transfer \- \- other\- repo=SRC_REPO \- \- from\- borg1 \e
2023-06-11 17:10:23 -04:00
\- \- compress=zstd,3 \- \- recompress=always
2025-05-19 17:20:38 -04:00
# to re\- chunk using different chunker parameters:
borg \- \- repo=DST_REPO transfer \- \- other\- repo=SRC_REPO \e
\- \- chunker\- params=buzhash,19,23,21,4095
2025-04-21 15:07:46 -04:00
.EE
2022-07-03 19:21:50 -04:00
.UNINDENT
.UNINDENT
2022-06-23 19:19:19 -04:00
.SH OPTIONS
.sp
See \fI borg\- common(1)\fP for common options of Borg commands.
2025-04-21 15:07:46 -04:00
.SS options
2022-06-23 19:19:19 -04:00
.INDENT 0 .0
.TP
.B \- n\fP,\fB \- \- dry\-run
do not change repository, just check
.TP
.BI \- \- other\-repo \ SRC_REPOSITORY
transfer archives from the other repository
2022-07-03 19:21:50 -04:00
.TP
2024-09-07 16:31:48 -04:00
.B \- \- from\-borg1
other repository is borg 1.x
.TP
2022-07-03 19:21:50 -04:00
.BI \- \- upgrader \ UPGRADER
use the upgrader to convert transferred data (default: no conversion)
2023-06-11 17:10:23 -04:00
.TP
.BI \- C \ COMPRESSION\fR,\fB \ \- \- compression \ COMPRESSION
select compression algorithm, see the output of the \(dq borg help compression\(dq command for details.
.TP
.BI \- \- recompress \ MODE
recompress data chunks according to \fI MODE\fP and \fB \- \- compression\fP \& . Possible modes are \fI always\fP : recompress unconditionally; and \fI never\fP : do not recompress (faster: re\- uses compressed data chunks w/o change).If no MODE is given, \fI always\fP will be used. Not passing \- \- recompress is equivalent to \(dq \- \- recompress never\(dq .
2025-05-19 17:20:38 -04:00
.TP
.BI \- \- chunker\-params \ PARAMS
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
2022-06-23 19:19:19 -04:00
.UNINDENT
.SS Archive filters
.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
2023-02-26 15:30:54 -05:00
.TP
.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.
2022-06-23 19:19:19 -04:00
.UNINDENT
2022-06-26 07:56:33 -04:00
.SH EXAMPLES
2026-06-16 08:17:43 -04:00
.sp
To keep the following examples short and readable, we export the repository
locations and passphrases first:
2022-06-26 07:56:33 -04:00
.INDENT 0 .0
2022-06-26 14:11:41 -04:00
.INDENT 3 .5
2022-06-26 07:56:33 -04:00
.sp
2025-04-21 15:07:46 -04:00
.EX
2026-06-16 08:17:43 -04:00
export BORG_REPO=ssh://borg2@borgbackup/./tests/b20
export BORG_PASSPHRASE=\(aq your\- borg2\- repo\- passphrase\(aq
export BORG_OTHER_REPO=ssh://borg2@borgbackup/./tests/b1x
export BORG_OTHER_PASSPHRASE=\(aq your\- borg1\- repo\- passphrase\(aq
.EE
.UNINDENT
.UNINDENT
.INDENT 0 .0
.INDENT 3 .5
.sp
.EX
# Borg 1.x repository \- > Borg 2.0 repository (hmac\- sha256 \- > hmac\- sha256, keeping the same chunk ID algorithm)
# 0. Have Borg 2.0 installed on the client AND server; have a Borg 1.x repository copy for testing.
2022-06-26 14:11:41 -04:00
2022-09-10 10:03:27 -04:00
# 1. Create a new \(dq related\(dq repository:
2026-06-16 08:17:43 -04:00
# Here, the existing Borg 1.x repository used repokey (and AES\- CTR mode),
# thus we use aes256\- ocb for the new Borg 2.0 repository.
# Staying with the same chunk ID algorithm (hmac\- sha256) and with the same
# key material (via BORG_OTHER_REPO) will make deduplication work
2022-06-26 07:56:33 -04:00
# between old archives (copied with borg transfer) and future ones.
2025-12-23 12:00:09 -05:00
# The AEAD cipher does not matter (everything must be re\- encrypted and
2026-06-16 08:17:43 -04:00
# re\- authenticated anyway); you could also choose chacha20\- poly1305.
$ borg repo\- create \- e aes256\- ocb
# 2. Check what and how much it would transfer:
$ borg transfer \- \- from\- borg1 \- \- dry\- run
# 3. Transfer (copy) archives from the old repository into the new repository (takes time and space!):
$ borg transfer \- \- from\- borg1
# 4. Check whether we have everything (same as step 2):
$ borg transfer \- \- from\- borg1 \- \- dry\- run
.EE
.UNINDENT
.UNINDENT
.INDENT 0 .0
.INDENT 3 .5
.sp
.EX
# Borg 1.x repository \- > Borg 2.0 repository (blake2 \- > blake3, changing the chunk ID algorithm)
# 0. Have Borg 2.0 installed on the client AND server; have a Borg 1.x repository copy for testing.
# 1. Create a new \(dq related\(dq repository:
# Here, the existing Borg 1.x repository used repokey\- blake2 (and AES\- CTR mode),
# thus we use aes256\- ocb with \- \- id\- hash blake3 for the new Borg 2.0 repository.
# We need to change from blake2 to blake3, because blake2 is not supported
# for borg2 repos (blake3 is much faster). Because we change how chunk IDs are
# computed, we need to re\- chunk everything while doing the transfer.
# The chunker parameters you provide here should be the same as you will
# use for all future Borg 2.0 archives.
# The AEAD cipher does not matter (everything must be re\- encrypted and
# re\- authenticated anyway); you could also choose \- e chacha20\- poly1305 \- i blake3.
$ borg repo\- create \- e aes256\- ocb \- i blake3
$ export CHUNKER_PARAMS=\(dq buzhash64,19,23,21,4095\(dq
2022-06-26 14:11:41 -04:00
2022-06-26 07:56:33 -04:00
# 2. Check what and how much it would transfer:
2026-06-16 08:17:43 -04:00
$ borg transfer \- \- from\- borg1 \- \- chunker\- params=$CHUNKER_PARAMS \- \- dry\- run
2022-06-26 14:11:41 -04:00
2025-12-23 12:00:09 -05:00
# 3. Transfer (copy) archives from the old repository into the new repository (takes time and space!):
2026-06-16 08:17:43 -04:00
$ borg transfer \- \- from\- borg1 \- \- chunker\- params=$CHUNKER_PARAMS
2022-06-26 14:11:41 -04:00
2025-12-23 12:00:09 -05:00
# 4. Check whether we have everything (same as step 2):
2026-06-16 08:17:43 -04:00
$ borg transfer \- \- from\- borg1 \- \- chunker\- params=$CHUNKER_PARAMS \- \- dry\- run
2025-04-21 15:07:46 -04:00
.EE
2022-06-26 07:56:33 -04:00
.UNINDENT
.UNINDENT
2026-06-16 08:17:43 -04:00
.SS Keyfile considerations when upgrading from Borg 1 .x
2026-03-15 09:34:31 -04:00
.sp
2026-06-16 08:17:43 -04:00
If you are using a \fB keyfile\fP encryption mode (not \fB repokey\fP ), Borg 2
may not automatically find your Borg 1.x key file, because the default
2026-03-15 09:34:31 -04:00
key file directory has changed on some platforms due to the switch to
the platformdirs \% <https://\: pypi\: .org/\: project/\: platformdirs/> library.
.sp
2026-06-16 08:17:43 -04:00
On \fB Linux\fP , there is typically no change \- \- both Borg 1.x and Borg 2
2026-03-15 09:34:31 -04:00
use \fB ~/.config/borg/keys/\fP \& .
.sp
2026-06-16 08:17:43 -04:00
On \fB macOS\fP , Borg 1.x stored key files in \fB ~/.config/borg/keys/\fP ,
but Borg 2 defaults to \fB ~/Library/Application Support/borg/keys/\fP \& .
2026-03-15 09:34:31 -04:00
.sp
2026-06-16 08:17:43 -04:00
On \fB Windows\fP , Borg 1.x used XDG\- style paths (e.g. \fB ~/.config/borg/keys/\fP ),
while Borg 2 defaults to \fB C:\e Users\e <user>\e AppData\e Roaming\e borg\e keys\e \fP \& .
2026-03-15 09:34:31 -04:00
.sp
2026-06-16 08:17:43 -04:00
If Borg 2 cannot find your key file, you have several options:
2026-03-15 09:34:31 -04:00
.INDENT 0 .0
.IP 1 . 3
\fB Copy the key file\fP from the old location to the new one.
.IP 2 . 3
\fB Set BORG_KEYS_DIR\fP to point to the old key file directory:
.INDENT 3 .0
.INDENT 3 .5
.sp
.EX
export BORG_KEYS_DIR=~/.config/borg/keys
.EE
.UNINDENT
.UNINDENT
.IP 3 . 3
\fB Set BORG_KEY_FILE\fP to point directly to the specific key file:
.INDENT 3 .0
.INDENT 3 .5
.sp
.EX
export BORG_KEY_FILE=~/.config/borg/keys/your_key_file
.EE
.UNINDENT
.UNINDENT
.IP 4 . 3
2026-06-16 08:17:43 -04:00
\fB Set BORG_BASE_DIR\fP to force Borg 2 to use the same base directory
as Borg 1.x:
2026-03-15 09:34:31 -04:00
.INDENT 3 .0
.INDENT 3 .5
.sp
.EX
export BORG_BASE_DIR=$HOME
.EE
.UNINDENT
.UNINDENT
.sp
2026-06-16 08:17:43 -04:00
This makes Borg 2 use \fB $HOME/.config/borg\fP , \fB $HOME/.cache/borg\fP ,
etc., matching Borg 1.x behavior on all platforms.
2026-03-15 09:34:31 -04:00
.UNINDENT
.sp
See \fI env_vars\fP for more details on directory environment variables.
2022-06-23 19:19:19 -04:00
.SH SEE ALSO
.sp
\fI borg\- common(1)\fP
2026-03-15 09:34:31 -04:00
.SH Author
2022-06-23 19:19:19 -04:00
The Borg Collective
2026-03-15 09:34:31 -04:00
. \" End of generated man page.