explaingit

borgbackup/borg

13,317PythonAudience · ops devopsComplexity · 3/5Setup · moderate

TLDR

A backup tool that saves space by only storing new chunks when files haven't changed, with encryption and easy remote backups over SSH.

Mindmap

mindmap
  root((repo))
    What it does
      Deduplication backup
      Encrypt before upload
      Compress data
      Mount as folder
    Supported Systems
      Linux
      macOS
      FreeBSD
      Windows via WSL
    Use Cases
      Daily server backup
      Remote SSH backup
      Restore single files
    Tech Stack
      Python
      SSH transport
      Multiple compressors
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Set up encrypted daily backups of a server to a remote SSH host with minimal storage growth over time.

USE CASE 2

Back up your laptop and restore a single file without extracting the whole archive.

USE CASE 3

Run space-efficient incremental backups of large datasets that barely grow with each daily run.

USE CASE 4

Mount a past backup as a regular folder to browse and retrieve specific file versions.

Tech stack

PythonSSHlz4zstdzliblzmaFUSE

Getting it running

Difficulty · moderate Time to first run · 30min

Must install Borg on both local and remote server for best performance, requires SSH access to a backup destination.

In plain English

BorgBackup (short: Borg) is a backup program focused on efficient storage through deduplication. When you run a backup, Borg splits your files into chunks and checks each chunk against what is already stored in the repository. If a chunk already exists, it is skipped entirely. This means a second backup of largely unchanged files takes very little additional space, and daily incremental backups accumulate slowly even for large data sets. Backups can be compressed using several algorithms ranging from fast-and-light to slow-and-compact: lz4, zstd, zlib, and lzma. All data can also be encrypted on your machine before it leaves, using 256-bit authenticated encryption, which means your files are protected even if someone gains access to the storage server. An optional obfuscation mode can disguise chunk sizes to make it harder to fingerprint your backup contents from the outside. Borg works well for remote backups over SSH. If Borg is also installed on the remote server, some processing happens there, which improves performance compared to accessing backup storage over a standard network share. Once a backup is stored, you can mount it as a file system and browse its contents like a normal folder, which makes restoring individual files straightforward without extracting an entire archive. The tool runs on Linux, macOS, and FreeBSD, with experimental support on Windows via Windows Subsystem for Linux. The repository's README notes that the current master branch is Borg version 2, which is in beta and not recommended for production backups. The stable version is documented at the project's main website.

Copy-paste prompts

Prompt 1
Write a bash script that uses BorgBackup to back up ~/Documents to a remote SSH server at [email protected]:/backups with AES-256 encryption and runs every night.
Prompt 2
I have a BorgBackup repository at /mnt/backups/myrepo. Show me how to mount it and browse its contents to find a file I deleted last week.
Prompt 3
Write a BorgBackup prune command that keeps 7 daily, 4 weekly, and 6 monthly archives and deletes older ones automatically.
Prompt 4
I want to start using BorgBackup on macOS. Walk me through initializing an encrypted repository and creating my first backup of /Users/me.
Open on GitHub → Explain another repo

← borgbackup on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.