Borg is a simple python tool to create backups. It has many benefits over other classical backup solutions (like rsync):
I've been playing around with borg a while and it seems to be simply awesome. See the good documentation for more: Borg - Quick Start
Most Linux Distributions have it already in their official repository. For Debian Jessie, you can install it from the backport-repository:
# apt-get -t jessie-backports install borgbackup
The configuration on the Backup-Server is simple, since the clients connect to the server using SSH. So you might just want to setup a singe borg-user and restrict the clients a little bit.
In my case, I also set the home-directory of the borg-user to my Backup drive.
First of all, every client needs a repository. The repository can be encrypted but in this case, we'll leave it unencrypted:
# borg init user@backupserver:reponame
This is what I use (f.e.):
# borg init nold@backup:myclient
Again, since borg has many options (f.e. for compression or debugging) we'll keep it simple. See the Docs for more: Borg - Creating Backups
# borg create -v --stats nold@backup:myclient::myhomebackup-2016-01-30 /home/nold
Here is a more advanced example using compression:
borg create -v --stats -C lzma,5 nold@backup:myclient::root-2016-01-30 / \ --exclude /proc \ --exclude /media \ --exclude /home \ --exclude /mnt \ --exclude /sys \ --exclude /run \ --exclude /dev \ --exclude /tmp
So this will backup root, compress it using lzma with a grade of 5 and exclude all directories we don't want.
# borg list nold@backup:myclient root-2016-01-27 Wed, 2016-01-27 17:58:53 root-2016-01-28 Thu, 2016-01-28 16:44:11 root-2016-01-29 Fri, 2016-01-29 06:32:56 root-2016-01-31 Sun, 2016-01-31 09:44:47 root-2016-02-01 Mon, 2016-02-01 10:37:38 root-2016-02-02 Tue, 2016-02-02 17:37:02 root-2016-02-03 Wed, 2016-02-03 06:25:04
# borg info nold@backup:myclient::root-2016-02-03 Name: root-2016-02-03 Fingerprint: 16a993dd867ab8a2054aaed8c5... Hostname: myclient Username: root Time: Wed, 2016-02-03 06:25:04 Command line: /usr/bin/borg create -v --stats -C lzma,5 nold@backup:myclient::root-2016-02-03 / --exclude /proc --exclude /media --exclude /home --exclude /mnt --exclude /sys --exclude /run --exclude /dev --exclude /tmp --exclude /var --exclude /opt Number of files: 811818 Original size Compressed size Deduplicated size This archive: 19.00 GB 7.37 GB 427.63 kB All archives: 176.27 GB 71.77 GB 13.08 GB Unique chunks Total chunks Chunk index: 679137 7662253
So here you can see the “Borg-Magic”! This backup only has a size of 427.63kB. And all Backups just use 13GB, even if their original size would be more than 10 times of it.
Backup is important, but mostly even more important is getting it recovered.
So this will recover /etc to the local directory we're currently in:
# pwd /root/recovery # borg extract nold@backup:myclient::root-2016-02-03 etc # ls etc
So if we want to recover the whole root-filesystem:
# pwd / # borg extract nold@backup:myclient::root-2016-02-03