From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

BorgBackup (short: Borg) is a deduplicating backup program. Optionally, it supports compression and authenticated encryption.

The main goal of Borg is to provide an efficient and secure way to back up data. The data deduplication technique used makes Borg suitable for daily backups since only changes are stored. The authenticated encryption technique makes it suitable for backups to targets not fully trusted.


USE flags

USE flags for app-backup/borgbackup Deduplicating backup program with compression and authenticated encryption

debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)


root #emerge --ask app-backup/borgbackup


Initializing a new repository

Before backups can be made, a repository must be initialized

user $borg init --encryption=repokey /path/to/repo

Backing up directories

user $borg create /path/to/repo::ArchiveName ~/src ~/Documents

Statistics can be output with the --stats argument.

user $borg create --stats /path/to/repo::ArchiveName ~/src ~/Documents
Archive name: ArchiveName
Archive fingerprint: bd31004d58f51ea06ff735d2e5ac49376901b21d58035f8fb05dbf866566e3c2
Time (start): Tue, 2016-02-16 18:15:11
Time (end):   Tue, 2016-02-16 18:15:11

Duration: 0.19 seconds
Number of files: 127
                      Original size      Compressed size    Deduplicated size
This archive:                4.16 MB              4.17 MB             26.78 kB
All archives:                8.33 MB              8.34 MB              4.19 MB

                      Unique chunks         Total chunks
Chunk index:                     132                  261

Listing archives in a repository

user $borg list /path/to/repo
First                               Mon, 2016-02-15 19:14:44
Second                              Tue, 2016-02-16 19:15:11

Listing contents of an archive

user $borg list /path/to/repo::ArchiveName
drwxr-xr-x user   group          0 Mon, 2016-02-15 18:22:30 home/user/Documents
-rw-r--r-- user   group       7961 Mon, 2016-02-15 18:22:30 home/user/Documents/Important.doc

Restoring an archive

user $borg extract /path/to/repo::ArchiveName

Deleting an archive

user $borg delete /path/to/repo::ArchiveName

Compacting a repository

Compacting a repository allows borg to recover disk space by compacting segment files

user $borg compact /path/to/repo

See also

  • restic — a Go-based backup tool built simplicity, scalability, and verifiability in mind.
  • dd — a utility used to copy raw data from a source into sink, where source and sink can be a block device, file, or piped input/output.
  • rsnapshot — an automated backup tool based on the rsync protocol and written in Perl.