borg(1)
Borg Backup is a deduplicating backup program that creates space-efficient, encrypted backups with a focus on security and performance.
Synopsis
borg [GLOBAL_OPTIONS] COMMAND [COMMAND_OPTIONS] [ARGUMENTS]Description
Borg Backup deduplicates file content across multiple backups, storing only the data that has changed. It uses strong encryption by default and is designed for both local and remote backups over SSH. Each backup is called an "archive" and multiple archives are stored in a "repository."
Borg is ideal for automated backups and handles large datasets efficiently by detecting and storing only new or modified content. It supports incremental backups, checksumming, and recovery from incomplete or corrupted backups.
Common options
| Flag | What it does |
|---|---|
-v, --verbose | Display verbose progress information |
--progress | Show progress information during long operations |
--list | List the archives in a repository or files in an archive |
-e, --exclude | Exclude files matching pattern (can be used multiple times) |
--exclude-from | Read exclusion patterns from file |
-s, --stats | Display backup statistics (stored size, deduplicated size, original size) |
--compression | Set compression algorithm (lz4, zstd, zlib, or none); e.g., lz4 or zstd,6 |
--checkpoint-interval | Create intermediate checkpoints every N seconds (default: 300) |
--one-file-system | Do not cross filesystem boundaries |
--keep-daily, --keep-weekly | Keep N daily/weekly backups when pruning (used with 'prune' command) |
Examples
Initialize a new encrypted repository at /mnt/backup/myrepo with a password-protected key
borg init -e repokey /mnt/backup/myrepoCreate a backup archive named with current timestamp, backing up /home/user/documents with progress display
borg create --progress --stats /mnt/backup/myrepo::{now} /home/user/documentsList all archives stored in the repository
borg list /mnt/backup/myrepoExtract a specific archive to restore files
borg extract --progress /mnt/backup/myrepo::backup-2024-01-15 /home/user/documentsDelete old backups according to retention policy (keep 7 daily, 4 weekly, 12 monthly)
borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=12 /mnt/backup/myrepoCreate backup while excluding patterns read from a file
borg create --exclude-from /etc/borg-exclude.txt /mnt/backup/myrepo::{now} /homeBackup with multiple exclusions and zstd compression at level 6
borg create -e '*.tmp' -e '.cache' --compression zstd,6 /mnt/backup/myrepo::{now} /home/userCreate a backup on a remote server over SSH (remote repository)
borg create --progress [email protected]:backup-repo::{now} /home/user