Borg

Borg is a backup tool that is smart about deduplicating files. It only needs ssh to store encrypted backups in a remote place, but Borg must be installed on both the server and the client for this to work. It is possible to setup end to end encryption, so that even the root user on the server is not able to read the contents of the files.

Backups are grouped in repositories. A repository contains all the backups for a bunch of files that you want to backup regularly. For instance, the contents of your home folder. In a repository one creates different archives, that is: different snapshots of the files at a certain time.

It is possible to share a single repository with different clients, and backup/restore the same set of files on different clients, but this is not efficient. Also, a client creates an exclusive lock, so simultaneous backups will fail. However, this feature can be useful to create the initial snapshot through a different client if the backup is large and upload speed is limited.

Encryption

It is possible to store the encryption key outside the repository, use the keyfile mode when creating the repository. The key will be stored in ~/.config/borg/keys. Make sure to to export it and store it somewhere safe, so it will be possible to restore the backup on another device if the first one becomes inaccessible. One needs both the key and the passphrase to access the backup.

== Common Options

-p displays progress during the operation.

-s shows statistics at the end of an operation.

-e excludes paths matching a pattern (see borg help patterns).

Commands

Create new repository:

borg init --encryption=keyfile server:/path/to/repo

Create new archive in repository:

borg create -p server:/path/to/repo::ARCHIVENAME ~/FOLDER1 ~/FOLDER2

List all archives:

borg list server:/path/to/repo

Restore archive in the current directory:

borg extract server:/path/to/repo::ARCHIVENAME

Delete old archives and recover diskspace:

borg delete server:/path/to/repo::ARCHIVENAME

Export key:

borg key export server:/path/to/repo exported.key

Import key:

borg key import server:/path/to/repo exported.key

Source