borg(1)

πŸ‘‘ NAME πŸ‘‘

bestie. gather round. this is the manual page for borg from the borg backup tool, section 1 of the manual. and what is it? it's a deduplicating and encrypting backup tool</p>. that's the whole vibe. πŸ’…


✨ SYNOPSIS ✨

borg [common options] <command> [options] [arguments]

like, that's the shape of every single thing you're gonna type. common options first, then the command, then that command's own options, then the arguments. simple. iconic. 🫢


🌸 DESCRIPTION 🌸

BorgBackup (everyone calls it Borg, it's giving nickname energy) is a deduplicating backup program. and optionally? it also does compression and authenticated encryption. so yeah. it can do the most. πŸ”₯

the whole main goal of Borg is to give you an efficient and secure way to back up data. the deduplication thing it does means only the changes get stored, which makes it genuinely perfect for daily backups β€” no cap. and the authenticated encryption means you can yeet your backups to targets that are not fully trusted. so brave. so safe. πŸ’–

so here's the mental model, bestie, write this down:

  • Borg stores a set of files in an archive.
  • A repository is a collection of archives.
  • The format of repositories is Borg-specific.

and the important part: Borg does not distinguish archives from each other in any way other than their name. it does not care when or where archives were created (like, different hosts? whatever, don't matter). it's just vibes and names. 🌈


πŸŽ€ EXAMPLES πŸŽ€

A step-by-step example

okay so here's the little origin story of a backup. follow along, it's a journey. πŸ¦‹

  1. before a backup can be made, a repository has to be initialized:
$ borg init --encryption=repokey /path/to/repo
  1. back up the ~/src and ~/Documents directories into an archive called Monday:
$ borg create /path/to/repo::Monday ~/src ~/Documents
  1. the next day, create a new archive called Tuesday:
$ borg create --stats /path/to/repo::Tuesday ~/src ~/Documents

this backup will be a lot quicker and a lot smaller since only new, never-before-seen data is stored. the --stats option causes Borg to output statistics about the newly created archive, like the amount of unique data (not shared with other archives):

------------------------------------------------------------------------------
Archive name: Tuesday
Archive fingerprint: bd31004d58f51ea06ff735d2e5ac49376901b21d58035f8fb05dbf866566e3c2
Time (start): Tue, 2016-02-16 18:15:11
Time (end):   Tue, 2016-02-16 18:15:11

Duration: 0.19 seconds
Number of files: 127
------------------------------------------------------------------------------
                      Original size      Compressed size    Deduplicated size
This archive:                4.16 MB              4.17 MB             26.78 kB
All archives:                8.33 MB              8.34 MB              4.19 MB

                      Unique chunks         Total chunks
Chunk index:                     132                  261
------------------------------------------------------------------------------
  1. list all the archives in the repository:
$ borg list /path/to/repo
Monday                               Mon, 2016-02-15 19:14:44
Tuesday                              Tue, 2016-02-16 19:15:11
  1. list the contents of the Monday archive:
$ borg list /path/to/repo::Monday
drwxr-xr-x user   group          0 Mon, 2016-02-15 18:22:30 home/user/Documents
-rw-r--r-- user   group       7961 Mon, 2016-02-15 18:22:30 home/user/Documents/Important.doc
...
  1. restore the Monday archive by extracting the files relative to the current directory:
$ borg extract /path/to/repo::Monday
  1. delete the Monday archive (and like, please note that this does not free repo disk space, okay? deleting is not the same as cleaning up, and that's a whole thing):
$ borg delete /path/to/repo::Monday
  1. recover that disk space by compacting the segment files in the repo:
$ borg compact /path/to/repo
Note: Borg is quiet by default β€” it works on WARNING log level. you can use options like --progress or --list to get specific reports during command execution. you can also add the -v (or --verbose or --info) option to adjust the log level to INFO and get other informational messages. so like, if you're out here like "why is it silent 😭" β€” that's why. it's just a chill guy.

πŸ’€ NOTES πŸ’€

Positional Arguments and Options: Order matters

okay this one is important, i'm gonna need you to focus. Borg only supports taking options (-s and --progress in the example) to the left or right of all positional arguments (repo::archive and path in the example), but not in between them:

borg create -s --progress repo::archive path  # good and preferred
borg create repo::archive path -s --progress  # also works
borg create -s repo::archive path --progress  # works, but ugly
borg create repo::archive -s --progress path  # BAD

and why is it like this? because of a problem in the argparse module: <https://bugs.python.org/issue15112>. so blame python, not us. πŸ™ˆ

Repository URLs

local filesystem (or a locally mounted network filesystem):

  • /path/to/repo β€” filesystem path to repo directory, absolute path
  • path/to/repo β€” filesystem path to repo directory, relative path

also, stuff like ~/path/to/repo or ~other/path/to/repo works (this is expanded by your shell).

Note: you may also prepend a file:// to a filesystem path to get URL style. cute, right?

remote repositories accessed via ssh <user@host>:

  • ssh://user@host:port/path/to/repo β€” remote repo, absolute path, port can be given
  • user@host:/path/to/repo β€” remote repo, absolute path, deprecated syntax

remote repositories with relative paths, URL style syntax with port:

  • ssh://user@host:port/./path/to/repo β€” path relative to current directory
  • ssh://user@host:port/~/path/to/repo β€” path relative to user's home directory
  • ssh://user@host:port/~other/path/to/repo β€” path relative to other's home directory (deprecated)

remote repositories with relative paths, deprecated SCP style syntax:

  • user@host:path/to/repo β€” path relative to current directory
  • user@host:~/path/to/repo β€” path relative to user's home directory
  • user@host:~other/path/to/repo β€” path relative to other's home directory
Note: giving user@host:/./path/to/repo or user@host:/~/path/to/repo or user@host:/~other/path/to/repo is also supported, but not required here.

if you frequently need the same repo URL, it's a good idea (honestly, do it) to set the BORG_REPO environment variable to set a default for the repo URL:

export BORG_REPO='ssh://user@host:port/path/to/repo'

then just leave the repo URL away if only a repo URL is needed and you want to use the default β€” it will be read from BORG_REPO then. 🫢

use the :: syntax to give the repo URL when syntax requires giving a positional argument for the repo (e.g. borg mount :: /mnt).

Repository / Archive Locations

a lot of commands want either a repository (just give the repo URL, see above) or an archive location, which is a repo URL followed by ::archive_name.

archive names must not contain the / (slash) character. and for simplicity, maybe also avoid blanks or other characters that have special meaning on the shell or in a filesystem (borg mount will use the archive name as directory name). so like... keep it cute, keep it simple. πŸŽ€

if you have set BORG_REPO (see above) and an archive location is needed, use ::archive_name β€” the repo URL part is then read from BORG_REPO.

Logging

Borg writes all log output to stderr by default. but listen, please note that something showing up on stderr does not indicate an error condition just because it is on stderr. check the log levels of the messages and the return code of borg to figure out error / warning / success conditions. don't panic. πŸ’œ

if you want to capture the log output to a file, just redirect it:

borg create repo::archive myfiles 2>> logfile

custom logging configurations can be implemented via BORG_LOGGING_CONF.

the log level of the builtin logging configuration defaults to WARNING. and why? because we want Borg to be mostly silent and only output warnings, errors and critical messages β€” unless output has been requested by supplying an option that implies output (e.g. --list or --progress).

log levels: DEBUG < INFO < WARNING < ERROR < CRITICAL

  • use --debug to set DEBUG log level β€” to get debug, info, warning, error and critical level output.
  • use --info (or -v or --verbose) to set INFO log level β€” to get info, warning, error and critical level output.
  • use --warning (default) to set WARNING log level β€” to get warning, error and critical level output.
  • use --error to set ERROR log level β€” to get error and critical level output.
  • use --critical to set CRITICAL log level β€” to get critical level output.

and while you can set misc. log levels, do not expect that every command will give different output on different log levels β€” it's just a possibility. manage your expectations bestie. 😭

Warning: options --critical and --error are provided for completeness, and their usage is not recommended as you might miss important information. like, you'll be missing lore. don't do it. 🚫

Return codes

Borg can exit with the following return codes (rc):

  • 0 β€” success (logged as INFO)
  • 1 β€” generic warning (operation reached its normal end, but there were warnings -- you should check the log, logged as WARNING)
  • 2 β€” generic error (like a fatal error, a local or remote exception, the operation did not reach its normal end, logged as ERROR)
  • 3..99 β€” specific error (enabled by BORG_EXIT_CODES=modern)
  • 100..127 β€” specific warning (enabled by BORG_EXIT_CODES=modern)
  • 128+N β€” killed by signal N (e.g. 137 == kill -9)

if you use --show-rc, the return code is also logged at the indicated level as the last log entry. so you'll always know how it went. ⭐


…The modern exit codes (return codes, "rc") are documented there: msgid


🌈 Environment Variables 🌈

okay bestie so Borg also sniffs around a bunch of environment variables for automation purposes, and honestly this list is long but every single one of them is here, no skips πŸ’…

πŸ’– General

  • BORG_REPO β€” set it and Borg uses that value as the default repository location. If a command needs an archive parameter, you can shorthand it as ::archive. If a command needs a repository parameter, you can either just leave it out or shorthand it as ::, in case a positional parameter is required.
  • BORG_PASSPHRASE β€” set it and this value becomes the answer to the passphrase question for encrypted repositories. It gets used both when a passphrase is needed to access an already-encrypted repo and when a brand new passphrase should be initially set while initializing an encrypted repo. Also peep BORG_NEW_PASSPHRASE. πŸ”
  • BORG_PASSCOMMAND β€” set it and the standard output of that command (trailing newlines stripped off) becomes the answer to the passphrase question for encrypted repositories. Same deal as above: it's used when you need a passphrase for an encrypted repo and when a new passphrase is being initially set during init of an encrypted repo. Heads up bestie: the command is executed without a shell. So variables like $HOME will work, but ~ will not. And if BORG_PASSPHRASE is also set, that one takes precedence. See also BORG_NEW_PASSPHRASE.
  • BORG_PASSPHRASE_FD β€” set it and you're specifying a file descriptor to read a passphrase from. Programs that start borg may choose to open an anonymous pipe and use it to pass a passphrase through. This is safer than passing it via BORG_PASSPHRASE, because on some systems (like Linux, looking at you) the environment can be examined by other processes. 😳 If BORG_PASSPHRASE or BORG_PASSCOMMAND are also set, they take precedence.
  • BORG_NEW_PASSPHRASE β€” set it and this value answers the passphrase question when a new passphrase is being asked for. This variable is checked first. If it's not set, BORG_PASSPHRASE and BORG_PASSCOMMAND get checked too. The main usecase here is fully automating borg key change-passphrase. ✨
  • BORG_DISPLAY_PASSPHRASE β€” set it and this value answers the "display the passphrase for verification" question when you're defining a new passphrase for encrypted repositories. πŸ‘€
  • BORG_EXIT_CODES β€” when set to "modern", the borg process returns more specific exit codes (rc). Default is "legacy", which returns rc 2 for all errors, 1 for all warnings, 0 for success.
  • BORG_HOST_ID β€” Borg usually computes a host id from the FQDN plus the results of uuid.getnode() (which usually returns a unique id based on the MAC address of the network interface). Except if that MAC happens to be all-zero β€” in that case it returns a random value, which is not what we want (because it kills automatic stale lock removal πŸ’€). So, if you have an all-zero MAC address, or other reasons to better externally control the host id, just set this environment variable to a unique value. If all your FQDNs are unique, you can just use the FQDN. If not, use <fqdn@uniqueid>.
  • BORG_HOSTNAME β€” set it and this value is used as the hostname (instead of the auto-detected one), e.g. to run borg on one host but impersonate another host (see #9651). This affects the hostname stored in newly created archives as well as the {hostname} placeholder. 🎭
  • BORG_USERNAME β€” set it and this value is used as the username (instead of the auto-detected one), e.g. to run borg as one user but impersonate another user. This affects the username stored in newly created archives as well as the {user} placeholder. 🫢
  • BORG_LOGGING_CONF β€” set it and the given filename is used as an INI-style logging configuration: https://docs.python.org/3/library/logging.config.html#configuration-file-format. A basic example conf can be found at docs/misc/logging.conf.
  • BORG_RSH β€” set it and this command is used instead of ssh. You can use this to specify ssh options, such as a custom identity file: ssh -i /path/to/private/key. See man ssh for other options. Using the --rsh CMD commandline option overrides the environment variable.
  • BORG_REMOTE_PATH β€” set it and the given path is used as the borg executable on the remote (defaults to "borg" if unset). Using --remote-path PATH commandline option overrides the environment variable.
  • BORG_FILES_CACHE_SUFFIX β€” set it to a value at least one character long and borg is instructed to use a specifically named (based on the suffix) alternative files cache. This can be used to avoid loading and saving cache entries for backup sources other than the current sources.
  • BORG_FILES_CACHE_TTL β€” set it to a numeric value and this determines the maximum "time to live" for the files cache entries (default: 20). The files cache is used to quickly determine whether a file is unchanged. The FAQ explains this in more detail over at: always_chunking.
  • BORG_USE_CHUNKS_ARCHIVE β€” when set to no (default: yes), the chunks.archive.d folder will not be used. This reduces disk space usage but slows down cache resyncs. βš–οΈ
  • BORG_SHOW_SYSINFO β€” when set to no (default: yes), system information (like OS, Python version, ...) in exceptions is not shown. Please only use this for good reasons, because it makes issues harder to analyze. πŸ™ˆ
  • BORG_MSGPACK_VERSION_CHECK β€” controls whether Borg checks the msgpack version. The default is yes (strict check). Set it to no to disable the version check and allow any installed msgpack version. Use this at your own risk; malfunctioning or incompatible msgpack versions may cause subtle bugs or repository data corruption. 😭
  • BORG_FUSE_IMPL β€” choose the lowlevel FUSE implementation borg shall use for borg mount. This is a comma-separated list of implementation names, and they get tried in the given order, e.g.:
    • pyfuse3,llfuse: default, first try to load pyfuse3, then try to load llfuse.
    • llfuse,pyfuse3: first try to load llfuse, then try to load pyfuse3.
    • pyfuse3: only try to load pyfuse3
    • llfuse: only try to load llfuse
    • none: do not try to load an implementation
  • BORG_SELFTEST β€” this can be used to influence borg's builtin self-tests. The default is to execute the tests at the beginning of each borg command invocation.

BORG_SELFTEST=disabled can be used to switch off the tests and rather save some time. Disabling is not recommended for normal borg users, but large scale borg storage providers can use this to optimize production servers after at least doing a one-time test borg (with selftests not disabled) when installing or upgrading machines / OS / borg. ⚠️

  • BORG_WORKAROUNDS β€” a list of comma separated strings that trigger workarounds in borg, e.g. to work around bugs in other software. Currently known strings are:
    • basesyncfile β€” use the more simple BaseSyncFile code to avoid issues with sync_file_range. You might need this to run borg on WSL (Windows Subsystem for Linux) or in systemd.nspawn containers on some architectures (e.g. ARM). Using this does not affect data safety, but might result in a more bursty write to disk behaviour (not continuously streaming to disk).
    • retry_erofs β€” retry opening a file without O_NOATIME if opening a file with O_NOATIME caused EROFS. You will need this to make archives from volume shadow copies in WSL1 (Windows Subsystem for Linux 1).
    • authenticated_no_key β€” work around a lost passphrase or key for an authenticated mode repository (these are only authenticated, but not encrypted). If the key is missing in the repository config, add key = anything there.
This workaround is only for emergencies and only to extract data from an affected repository (read-only access):
BORG_WORKAROUNDS=authenticated_no_key borg extract repo::archive

After you have extracted all data you need, you MUST delete the repository:

BORG_WORKAROUNDS=authenticated_no_key borg delete repo

Now you can init a fresh repo. Make sure you do not use the workaround any more. 🚨

  • ignore_invalid_archive_tam β€” work around invalid archive TAMs created by borg < 1.2.5, see #7791.

This workaround likely needs to get used only once when following the upgrade instructions for CVE-2023-36811, see archives_tam_vuln.

In normal production operations, this workaround should never be used. πŸ’€


Some automatic "answerers" (if set, they automatically answer confirmation questions): πŸ—£οΈ

  • BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no (or =yes) β€” For "Warning: Attempting to access a previously unknown unencrypted repository"

Okay bestie, back in the ENVIRONMENT section, we were doing the yes/no answer env vars. These are the ones that let you skip scary prompts in scripts, but be careful β€” they are literally your data's bodyguards. πŸ›‘οΈ

  • BORG_RELOCATED_REPO_ACCESS_IS_OK=no (or =yes) β€” For "Warning: The repository at location ... was previously located at ..."
  • BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO (or =YES) β€” For "This is a potentially dangerous function..." (that's the check --repair one, iykyk)
  • BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO (or =YES) β€” For "You requested to completely DELETE the repository including all archives it contains:"
Note: answers are case sensitive. Setting an invalid answer value might either give the default answer or ask you interactively, depending on whether retries are allowed (they by default are allowed). So please test your scripts interactively before making them a non-interactive script. No cap, test first, ship later. πŸ§ͺπŸ’…

Directories and files:

  • BORG_BASE_DIR β€” Defaults to $HOME or ~$USER or ~ (in that order). If you want to move all borg-specific folders to a custom path at once, all you need to do is to modify BORG_BASE_DIR: the other paths for cache, config etc. will adapt accordingly (assuming you didn't set them to a different custom value). It's giving "one env var to rule them all" πŸ‘‘
  • BORG_CACHE_DIR β€” Defaults to $BORG_BASE_DIR/.cache/borg. If BORG_BASE_DIR is not explicitly set while XDG env var XDG_CACHE_HOME is set, then $XDG_CACHE_HOME/borg is being used instead. This directory contains the local cache and might need a lot of space for dealing with big repositories. Make sure you're aware of the associated security aspects of the cache location: cache_security. Don't just leave it lying around, bestie. πŸ”
  • BORG_CONFIG_DIR β€” Defaults to $BORG_BASE_DIR/.config/borg. If BORG_BASE_DIR is not explicitly set while XDG env var XDG_CONFIG_HOME is set, then $XDG_CONFIG_HOME/borg is being used instead. This directory contains all borg configuration directories, see the FAQ for a security advisory about the data in this directory: home_config_borg. Protect it like your skincare routine. 🧴
  • BORG_SECURITY_DIR β€” Defaults to $BORG_CONFIG_DIR/security. This directory contains information borg uses to track its usage of NONCES ("numbers used once" - usually in encryption context) and other security relevant data. Very spy movie energy. πŸ•΅οΈβ€β™€οΈ
  • BORG_KEYS_DIR β€” Defaults to $BORG_CONFIG_DIR/keys. This directory contains keys for encrypted repositories. Guard these with your life. πŸ”‘
  • BORG_KEY_FILE β€” When set, use the given path as repository key file. Please note that this is only for rather special applications that externally fully manage the key files:
    • this setting only applies to the keyfile modes (not to the repokey modes).
    • using a full, absolute path to the key file is recommended.
    • all directories in the given path must exist.
    • this setting forces borg to use the key file at the given location.
    • the key file must either exist (for most commands) or will be created (borg init).
    • you need to give a different path for different repositories.
    • you need to point to the correct key file matching the repository the command will operate on.
  • TMPDIR β€” This is where temporary files are stored (might need a lot of temporary space for some operations), see tempfile for details. Clean up after yourself, queen. 🧹

Building:

  • BORG_OPENSSL_PREFIX β€” Adds given OpenSSL header file directory to the default locations (setup.py).
  • BORG_LIBLZ4_PREFIX β€” Adds given prefix directory to the default locations. If a 'include/lz4.h' is found Borg will be linked against the system liblz4 instead of a bundled implementation. (setup.py)
  • BORG_LIBZSTD_PREFIX β€” Adds given prefix directory to the default locations. If a 'include/zstd.h' is found Borg will be linked against the system libzstd instead of a bundled implementation. (setup.py)

Please note:

  • Be very careful when using the "yes" sayers, the warnings with prompt exist for your / your data's security/safety. This is not the vibe to be reckless. 🚨
  • Also be very careful when putting your passphrase into a script, make sure it has appropriate file permissions (e.g. mode 600, root:root). Lock it down like your diary. πŸ“”

File systems

We strongly recommend against using Borg (or any other database-like software) on non-journaling file systems like FAT, since it is not possible to assume any consistency in case of power failures (or a sudden disconnect of an external drive or similar failures). That's a no from us, bestie. πŸ’€

While Borg uses a data store that is resilient against these failures when used on journaling file systems, it is not possible to guarantee this with some hardware -- independent of the software used. We don't know a list of affected hardware. Hardware can be sus sometimes. 😭

If you are suspicious whether your Borg repository is still consistent and readable after one of the failures mentioned above occurred, run borg check --verify-data to make sure it is consistent. Do the vibe check on your data. ✨

Requirements for Borg repository file systems

  • Long file names
  • At least three directory levels with short names
  • Typically, file sizes up to a few hundred MB. Large repositories may require large files (>2 GB).
  • Up to 1000 files per directory.
  • rename(2) / MoveFile(Ex) should work as specified, i.e. on the same file system it should be a move (not a copy) operation, and in case of a directory it should fail if the destination exists and is not an empty directory, since this is used for locking.
  • Hardlinks are needed for borg_upgrade (if --inplace option is not used). Also hardlinks are used for more safe and secure file updating (e.g. of the repo config file), but the code tries to work also if hardlinks are not supported.

Units

To display quantities, Borg takes care of respecting the usual conventions of scale. Disk sizes are displayed in decimal (https://en.wikipedia.org/wiki/Decimal), using powers of ten (so kB means 1000 bytes). For memory usage, binary prefixes (https://en.wikipedia.org/wiki/Binary_prefix) are used, and are indicated using the IEC binary prefixes (https://en.wikipedia.org/wiki/IEC_80000-13#Prefixes_for_binary_multiples), using powers of two (so KiB means 1024 bytes). Math but make it fashion. πŸ’…

Date and Time

We format date and time conforming to ISO-8601, that is: YYYY-MM-DD and HH:MM:SS (24h clock).

For more information about that, see: https://xkcd.com/1179/

Unless otherwise noted, we display local date and time. Internally, we store and process date and time as UTC. Time zones? We don't know her. πŸ•°οΈ

Resource Usage

Borg might use a lot of resources depending on the size of the data set it is dealing with.

If one uses Borg in a client/server way (with a ssh: repository), the resource usage occurs in part on the client and in another part on the server.

If one uses Borg as a single process (with a filesystem repo), all the resource usage occurs in that one process, so just add up client + server to get the approximate resource usage.

CPU client:

  • borg create: does chunking, hashing, compression, crypto (high CPU usage)
  • chunks cache sync: quite heavy on CPU, doing lots of hashtable operations.
  • borg extract: crypto, decompression (medium to high CPU usage)
  • borg check: similar to extract, but depends on options given.
  • borg prune / borg delete archive: low to medium CPU usage
  • borg delete repo: done on the server

It won't go beyond 100% of 1 core as the code is currently single-threaded. Especially higher zlib and lzma compression levels use significant amounts of CPU cycles. Crypto might be cheap on the CPU (if hardware accelerated) or expensive (if not).

CPU server:

It usually doesn't need much CPU, it just deals with the key/value store (repository) and uses the repository index for that.

borg check: the repository check computes the checksums of all chunks (medium CPU usage) borg delete repo: low CPU usage

CPU (only for client/server operation):

When using borg in a client/server way with a <ssh:-type> repo, the ssh processes used for the transport layer will need some CPU on the client and on the server due to the crypto they are doing - esp. if you are pumping big amounts of data.

Memory (RAM) client:

The chunks index and the files index are read into memory for performance reasons. Might need big amounts of memory (see below). Compression, esp. lzma compression with high levels might need substantial amounts of memory.

Memory (RAM) server:

The server process will load the repository index into memory. Might need considerable amounts of memory, but less than on the client (see below).

Chunks index (client only):

Proportional to the amount of data chunks in your repo. Lots of chunks in your repo imply a big chunks index. It is possible to tweak the chunker params (see create options).

Files index (client only):

Proportional to the amount of files in your last backups. Can be switched off (see create options), but next backup might be much slower if you do. The speed benefit of using the files cache is proportional to file size.

Repository index (server only):

Proportional to the amount of data chunks in your repo. Lots of chunks in your repo imply a big repository index. It is possible to tweak the chunker params (see create options) to influence the amount of chunks being created.

Temporary files (client):

Reading data and metadata from a FUSE mounted repository will consume up to the size of all deduplicated, small chunks in the repository. Big chunks won't be locally cached.

Temporary files (server): okay so bestie, listen β€” every client that connects to a remote drops a non-trivial amount of data into that remote's temp directory. And for some remotes, that can absolutely fill up the default temporary directory at /tmp. πŸ’€ The fix? Make sure $TMPDIR, $TEMP, or $TMP is properly set for the sshd process. On some OSes you can literally just set the correct value in .bashrc (or whatever the equivalent login config file is for your shell), but in other cases you might first need to enable PermitUserEnvironment yes in your sshd_config file, and then add environment="TMPDIR=/my/big/tmpdir" at the start of the public key you're using in the authorized_hosts file. you got this 🫢

Cache files (client only): this one holds the chunks index and the files index β€” plus a collection of single-archive chunk indexes which might need huge amounts of disk space, depending on archive count and size (see the FAQ about how to reduce that πŸ‘€).

Network (only for client/server operation): if your repository is remote, all the deduplicated (and optionally compressed/encrypted) data of course has to go over the connection (ssh:// repo url). And if you use a locally mounted network filesystem, some copy operations used for transaction support also go over the connection. And if you back up multiple sources to one target repository, additional traffic happens for cache resynchronization. ✨ it's giving bandwidth, fr fr


πŸ¦‹ Support for file metadata πŸ¦‹

Besides regular file and directory structures, Borg can preserve:

  • symlinks (stored as symlink, the symlink is not followed) πŸ”—
  • special files:
    • character and block device files (restored via mknod)
    • FIFOs ("named pipes")
    • special file contents can be backed up in --read-special mode. By default the metadata to create them with mknod(2), mkfifo(2) etc. is stored.
  • hardlinked regular files, devices, FIFOs (considering all items in the same archive) πŸ”₯
  • timestamps in nanosecond precision: mtime, atime, ctime ⏱️
  • other timestamps: birthtime (on platforms supporting it)
  • permissions:
    • IDs of owning user and owning group
    • names of owning user and owning group (if the IDs can be resolved)
    • Unix Mode/Permissions (u/g/o permissions, suid, sgid, sticky)

On some platforms, additional features are supported. πŸ‘‘

The columns, bestie: ACLs [5] Β· xattr [6] Β· Flags [7]

  • Linux β€” ACLs [5]: Yes Β· xattr [6]: Yes Β· Flags [7]: Yes [1]
  • macOS β€” ACLs [5]: Yes Β· xattr [6]: Yes Β· Flags [7]: Yes (all)
  • FreeBSD β€” ACLs [5]: Yes Β· xattr [6]: Yes Β· Flags [7]: Yes (all)
  • OpenBSD β€” ACLs [5]: n/a Β· xattr [6]: n/a Β· Flags [7]: Yes (all)
  • NetBSD β€” ACLs [5]: n/a Β· xattr [6]: No [2] Β· Flags [7]: Yes (all)
  • Solaris and derivatives β€” ACLs [5]: No [3] Β· xattr [6]: No [3] Β· Flags [7]: n/a
  • Windows (cygwin) β€” ACLs [5]: No [4] Β· xattr [6]: No Β· Flags [7]: No

Other Unix-like operating systems may work as well, but have not been tested at all. 🌈 (untested territory, no cap β€” proceed with vibes only)

Note that most of the platform-dependent features also depend on the file system. For example, ntfs-3g on Linux isn't able to convey NTFS ACLs. πŸ™ˆ

  • [1] Only "nodump", "immutable", "compressed" and "append" are supported. Feature request #618 for more flags.
  • [2] Feature request #1332
  • [3] Feature request #1337
  • [4] Cygwin tries to map NTFS ACLs to permissions with varying degrees of success.
  • [5] The native access control list mechanism of the OS. This normally limits access to non-native ACLs. For example, NTFS ACLs aren't completely accessible on Linux with ntfs-3g.
  • [6] extended attributes; key-value pairs attached to a file, mainly used by the OS. This includes resource forks on Mac OS X.
  • [7] aka BSD flags. The Linux set of flags [1] is portable across platforms. The BSDs define additional flags.

πŸ‘‘ SEE ALSO πŸ‘‘

More places to lurk, because the lore runs deep: 🫢


πŸ’œ Author πŸ’œ

The Borg Collective β€” iconic, mysterious, they ate and left no crumbs. πŸŽ€


xoxo, that's the whole page bestie πŸ’… β€” sourced from orphan:, dated 2026-07-18, and yeah, it's the borg(1) manual. periodt. ⭐

πŸ“¦ where this page comes from