Borg - deduplicated backups

Here you can find tutorials and notes for server-side maintenance/configuration

Borg - deduplicated backups

Postby lik » Thu Nov 19, 2015 1:16 am

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 backup 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 not fully trusted targets.

GitHub borgbackup/borg

Installation instructions can be found at official documentation page.
For tests we can get prebuilt standalone-binary generated with pyinstaller at releases page:
Code: Select all
wget https://github.com/borgbackup/borg/releases/latest/download/borg-linux64 -O /usr/local/bin/borg && chmod +x /usr/local/bin/borg

Code: Select all
# borg
usage: borg [-h] [-V] <command> ...

Borg - Deduplicated Backups

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show version number and exit

required arguments:
  <command>
    serve               start repository server process
    init                initialize empty repository
    check               verify repository
    change-passphrase   change repository passphrase
    migrate-to-repokey  migrate passphrase-mode repository to repokey
    create              create backup
    extract             extract archive contents
    rename              rename archive
    delete              delete archive
    list                list archive or repository contents
    mount               mount repository
    info                show archive information
    break-lock          break repository and cache locks
    prune               prune archives
    upgrade             upgrade repository format
    debug-dump-archive-items
                        dump archive items (metadata) (debug)
    debug-get-obj       get object from repository (debug)
    debug-put-obj       put object to repository (debug)
    debug-delete-obj    delete object from repository (debug)

One can obtain additional usage information prepending help keyword:
Code: Select all
# borg help init
usage: borg init [-h] [-v] [--debug] [--lock-wait N] [--show-rc]
                 [--no-files-cache] [--umask M] [--remote-path PATH]
                 [-e {none,keyfile,repokey}]
                 [REPOSITORY]

Initialize an empty repository

positional arguments:
  REPOSITORY            repository to create

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose, --info
                        enable informative (verbose) output, work on log level
                        INFO
  --debug               enable debug output, work on log level DEBUG
  --lock-wait N         wait for the lock, but max. N seconds (default: 1).
  --show-rc             show/log the return code (rc)
  --no-files-cache      do not load/update the file metadata cache used to
                        detect unchanged files
  --umask M             set umask to M (local and remote, default: 0077)
  --remote-path PATH    set remote path to executable (default: "borg")
  -e {none,keyfile,repokey}, --encryption {none,keyfile,repokey}
                        select encryption key mode (default: "repokey")

This command initializes an empty repository. A repository is a filesystem
directory containing the deduplicated data from zero or more archives.
Encryption can be enabled at repository init time.


Example of 7 backup copies made by borg to get the idea of compression and deduplication ratio:

420.38GB ( ~ 7 * 60GB ) --> Compressed+Deduplicated --> 23G ( borg repository size )

Code: Select all
# export BORG_PASSPHRASE=somepassphrase
# export REPOSITORY=/backup/borg

# du -shx $REPOSITORY
23G     /backup/borg

# borg list $REPOSITORY
hostname_2015-11-08-1446937574   Sun Nov  8 01:10:08 2015
hostname_2015-11-15-1447542385   Sun Nov 15 01:10:18 2015
hostname_2015-11-22-1448147225   Sun Nov 22 01:11:23 2015
hostname_2015-11-25-1448406445   Wed Nov 25 01:11:14 2015
hostname_2015-11-26-1448492888   Thu Nov 26 01:13:27 2015
hostname_2015-11-27-1448579204   Fri Nov 27 01:11:19 2015
hostname_2015-11-28-1448665728   Sat Nov 28 01:15:59 2015

# borg info $REPOSITORY::hostname_2015-11-28-1448665728
Name: hostname_2015-11-28-1448665728
Fingerprint: 0c03ec60e379b661e812220ed1023dd21cb454dac82d75487b885fd5bd894ed9
Hostname: hostname
Username: root
Time: Sat Nov 28 01:15:59 2015
Command line: borg create --stats --one-file-system --compression zlib /backup/borg::hostname_2015-11-28-1448665728 /etc /var/spool/cron /home /usr/local/etc/scripts --exclude /etc/selinux --exclude *.pyc
Number of files: 261271

                       Original size      Compressed size    Deduplicated size
This archive:               60.18 GB             50.71 GB             17.45 MB
All archives:              420.38 GB            354.54 GB             24.45 GB

                       Unique chunks         Total chunks
Chunk index:                  537457              7882538
lik
Founder
Founder
 
Posts: 497
Joined: Wed Dec 15, 2010 3:21 am

Return to Server Side Actions

 


  • Related topics
    Replies
    Views
    Last post
cron