Docs / Backup & Recovery / Getting Started with Borg Backup

Getting Started with Borg Backup

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 34 views · 1 min read

What is Borg?

BorgBackup (Borg) is a deduplicating backup program that provides efficient, compressed, and encrypted backups. It only stores changed data blocks, making incremental backups extremely fast and space-efficient.

Installation

sudo apt install -y borgbackup

Initialize a Repository

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

# Remote repository
borg init --encryption=repokey ssh://backupuser@remote-server/backups/borg-repo

Creating a Backup

borg create --stats --progress \
  /backup/borg-repo::backup-{now:%Y-%m-%d} \
  /var/www \
  /etc \
  /home \
  --exclude "*.log" \
  --exclude "/home/*/.cache"

Restoring Files

# List available backups
borg list /backup/borg-repo

# Restore specific backup
cd /tmp/restore
borg extract /backup/borg-repo::backup-2026-02-25

# Restore a single file
borg extract /backup/borg-repo::backup-2026-02-25 var/www/html/index.php

Automated Pruning

borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=6 /backup/borg-repo

This keeps 7 daily, 4 weekly, and 6 monthly backups — automatically removing older archives to save space.

Was this article helpful?