borg [common options] transfer [options]
options |
||
|
do not change repository, just check |
|
|
transfer archives from the other repository |
|
|
other repository is borg 1.x |
|
|
use the upgrader to convert transferred data (default: no conversion) |
|
|
select compression algorithm, see the output of the “borg help compression” command for details. |
|
|
recompress data chunks according to MODE and |
|
|
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 |
|
Archive filters — Archive filters can be applied to repository targets. |
||
|
only consider archives matching all patterns. See “borg help match-archives”. |
|
|
Comma-separated list of sorting keys; valid keys are: timestamp, archive, name, id, tags, host, user; default is: timestamp |
|
|
consider the first N archives after other filters are applied |
|
|
consider the last N archives after other filters are applied |
|
|
consider archives between the oldest archive’s timestamp and (oldest + TIMESPAN), e.g., 7d or 12m. |
|
|
consider archives between the newest archive’s timestamp and (newest - TIMESPAN), e.g., 7d or 12m. |
|
|
consider archives older than (now - TIMESPAN), e.g., 7d or 12m. |
|
|
consider archives newer than (now - TIMESPAN), e.g., 7d or 12m. |
|
This command transfers archives from one repository to another repository. Optionally, it can also upgrade the transferred data. Optionally, it can also recompress the transferred data. Optionally, it can also re-chunk the transferred data using different chunker parameters.
It is easiest (and fastest) to give --compression=COMPRESSION --recompress=never using
the same COMPRESSION mode as in the SRC_REPO - borg will use that COMPRESSION for metadata (in
any case) and keep data compressed “as is” (saves time as no data compression is needed).
If you want to globally change compression while transferring archives to the DST_REPO,
give --compress=WANTED_COMPRESSION --recompress=always.
The default is to transfer all archives.
You could use the misc. archive filter options to limit which archives it will
transfer, e.g. using the -a option. This is recommended for big
repositories with multiple data sets to keep the runtime per invocation lower.
Transfer borg2 archives into a related other borg2 repository:
# create a related DST_REPO (reusing key material from SRC_REPO), so that
# chunking and chunk id generation will work in the same way as before.
borg --repo=DST_REPO repo-create --encryption=DST_ENC --other-repo=SRC_REPO
# 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?
To migrate your Borg 1.x archives into a related, new Borg 2 repository, usage is quite similar
to the above, but you need the --from-borg1 option:
borg --repo=DST_REPO repo-create --encryption=DST_ENC --other-repo=SRC_REPO --from-borg1
# to continue using lz4 compression as you did in SRC_REPO:
borg --repo=DST_REPO transfer --other-repo=SRC_REPO --from-borg1 \
--compress=lz4 --recompress=never
# alternatively, to recompress everything to zstd,3:
borg --repo=DST_REPO transfer --other-repo=SRC_REPO --from-borg1 \
--compress=zstd,3 --recompress=always
# to re-chunk using different chunker parameters:
borg --repo=DST_REPO transfer --other-repo=SRC_REPO \
--chunker-params=buzhash,19,23,21,4095
To keep the following examples short and readable, we export the repository locations and passphrases first:
export BORG_REPO=ssh://borg2@borgbackup/./tests/b20
export BORG_PASSPHRASE='your-borg2-repo-passphrase'
export BORG_OTHER_REPO=ssh://borg2@borgbackup/./tests/b1x
export BORG_OTHER_PASSPHRASE='your-borg1-repo-passphrase'
# 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.
# 1. Create a new "related" repository:
# 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
# between old archives (copied with borg transfer) and future ones.
# The AEAD cipher does not matter (everything must be re-encrypted and
# 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
# 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 "related" 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="buzhash64,19,23,21,4095,2"
# 2. Check what and how much it would transfer:
$ borg transfer --from-borg1 --chunker-params=$CHUNKER_PARAMS --dry-run
# 3. Transfer (copy) archives from the old repository into the new repository (takes time and space!):
$ borg transfer --from-borg1 --chunker-params=$CHUNKER_PARAMS
# 4. Check whether we have everything (same as step 2):
$ borg transfer --from-borg1 --chunker-params=$CHUNKER_PARAMS --dry-run
If you are using a keyfile encryption mode (not repokey), Borg 2
may not automatically find your Borg 1.x key file, because the default
key file directory has changed on some platforms due to the switch to
the platformdirs library.
On Linux, there is typically no change -- both Borg 1.x and Borg 2
use ~/.config/borg/keys/.
On macOS, Borg 1.x stored key files in ~/.config/borg/keys/,
but Borg 2 defaults to ~/Library/Application Support/borg/keys/.
On Windows, Borg 1.x used XDG-style paths (e.g. ~/.config/borg/keys/),
while Borg 2 defaults to C:\Users\<user>\AppData\Roaming\borg\keys\.
If Borg 2 cannot find your key file, you have several options:
Copy the key file from the old location to the new one.
Set BORG_KEYS_DIR to point to the old key file directory:
export BORG_KEYS_DIR=~/.config/borg/keys
Set BORG_KEY_FILE to point directly to the specific key file:
export BORG_KEY_FILE=~/.config/borg/keys/your_key_file
Set BORG_BASE_DIR to force Borg 2 to use the same base directory as Borg 1.x:
export BORG_BASE_DIR=$HOME
This makes Borg 2 use $HOME/.config/borg, $HOME/.cache/borg,
etc., matching Borg 1.x behavior on all platforms.
See Environment Variables for more details on directory environment variables.