DEV Community

Alex Spinov
Alex Spinov

Posted on

BorgBackup Has a Free Deduplicating Backup Program

BorgBackup (Borg) is a free, open-source deduplicating backup program with compression and authenticated encryption.

What Is BorgBackup?

BorgBackup is the backup tool that serious sysadmins use. It provides space-efficient storage through deduplication — only unique data chunks are stored, regardless of how many backups you make.

Key features:

  • Content-defined deduplication (huge space savings)
  • AES-256 authenticated encryption
  • LZ4, zstd, zlib, lzma compression
  • Remote backup via SSH
  • Mountable archives (browse backups as filesystem)
  • Free and open source (BSD license)
  • Proven reliability (10+ years, used by major organizations)

How Deduplication Saves Space

Traditional backup of a 10GB project:

  • Backup 1: 10GB
  • Backup 2: 10GB (even if only 100MB changed)
  • 30 daily backups: 300GB total

Borg backup of the same project:

  • Backup 1: 10GB
  • Backup 2: 100MB (only the changes)
  • 30 daily backups: ~13GB total

That's 95% less storage.

Quick Start

Install

# Ubuntu/Debian
sudo apt install borgbackup

# macOS
brew install borgbackup

# Arch
sudo pacman -S borg
Enter fullscreen mode Exit fullscreen mode

Initialize Repository

# Local repository with encryption
borg init --encryption=repokey /backup/my-borg-repo

# Remote repository via SSH
borg init --encryption=repokey user@server:/backup/my-repo
Enter fullscreen mode Exit fullscreen mode

Create a Backup

borg create /backup/my-repo::backup-{now} \
  /home/user/projects \
  /home/user/documents \
  --exclude *.pyc \
  --exclude __pycache__ \
  --exclude node_modules
Enter fullscreen mode Exit fullscreen mode

List Backups

borg list /backup/my-repo
Enter fullscreen mode Exit fullscreen mode

Restore Files

# Restore entire archive
borg extract /backup/my-repo::backup-2026-03-27

# Restore specific path
borg extract /backup/my-repo::backup-2026-03-27 home/user/projects/myapp
Enter fullscreen mode Exit fullscreen mode

Mount Backups as Filesystem

This is Borg's killer feature:

mkdir /mnt/borg
borg mount /backup/my-repo /mnt/borg

# Browse all backups like normal folders
ls /mnt/borg/
# backup-2026-03-25  backup-2026-03-26  backup-2026-03-27

# Copy a single file from any backup
cp /mnt/borg/backup-2026-03-25/home/user/projects/config.yml ./

# Unmount when done
borg umount /mnt/borg
Enter fullscreen mode Exit fullscreen mode

Automated Backup Script

#!/bin/bash
export BORG_REPO="user@server:/backup/my-repo"
export BORG_PASSPHRASE="your-secure-passphrase"

# Create backup
borg create ::backup-{now:%Y-%m-%d} /home/user/projects

# Prune old backups
borg prune \
  --keep-daily=7 \
  --keep-weekly=4 \
  --keep-monthly=6

# Compact repository
borg compact
Enter fullscreen mode Exit fullscreen mode

Add to cron: 0 3 * * * /home/user/backup.sh

Compression Options

# Fast compression (default)
borg create --compression lz4 ::backup-{now} /data

# Best compression
borg create --compression zstd,19 ::backup-{now} /data

# Auto-select based on file type
borg create --compression auto,zstd,6 ::backup-{now} /data
Enter fullscreen mode Exit fullscreen mode

Storage Comparison

Solution 100GB data, 30 days Encryption Dedup
rsync ~3TB (full copies) No No
tar.gz daily ~1.5TB No No
Borg ~120GB Yes Yes
Time Machine ~500GB Optional Partial

BorgBase: Managed Hosting

BorgBase offers free hosted Borg repositories:

  • Free tier: 10GB, 2 repositories
  • Automatic monitoring and alerts
  • Append-only mode for ransomware protection

Who Uses Borg?

With 11K+ GitHub stars:

  • System administrators backing up servers
  • Developers with local backup workflows
  • Companies needing encrypted, efficient backups
  • NAS users (Synology, TrueNAS support)

Get Started

  1. Install borgbackup
  2. Initialize an encrypted repository
  3. Run your first backup
  4. Set up cron for automation

Your backups will be encrypted, deduplicated, and compressed. Restore any file from any point in time.


Need to back up web data automatically? Check out my web scraping tools on Apify — collect and store data from any website on schedule. Custom solutions: spinov001@gmail.com

Top comments (0)