LinuxmacOS

Where Does BorgBackup Store Config and Cache?

Borg splits config, keys, and cache across XDG folders. The default Linux and macOS spots and the env vars.

Last updated

BorgBackup keeps three things apart. Config and key material live under ~/.config/borg. The chunk cache lives under ~/.cache/borg. The repository itself lives wherever you ran borg init, local or remote.

Keys decide everything. Repos created with keyfile mode need files in ~/.config/borg/keys to open at all. The cache holds checksums and per archive indexes, so losing it costs time, not data. Repos track their ID, and the cache folder per repo is named by that ID.

Where BorgBackup stores this, by platform

Linux
~/.config/borg

Config dir with keys and security subfolders. Cache dir holds per repo ID folders that can grow large. Move with BORG_CONFIG_DIR and BORG_CACHE_DIR when needed.

macOS
~/.config/borg

Same XDG layout as Linux for Homebrew and MacPorts builds. Repositories are user placed; only the config and cache default here. Guard the keys subfolder like a password.

Frequently asked questions

what must i back up for borg

Copy ~/.config/borg (keys and security state) plus the repository itself. The cache under ~/.cache/borg speeds things up but rebuilds automatically. Without the keys directory, keyfile repos are unrecoverable.

how do i move borg cache off a small home disk

Set BORG_CONFIG_DIR, BORG_CACHE_DIR, and BORG_BASE_DIR to move them. BORG_BASE_DIR re-roots all three at once. XDG_CONFIG_HOME and XDG_CACHE_HOME are honored when the BORG specific vars are unset.

Notice an outdated path? Let us know.