duplicity - Backblaze

This is one post in a series of tutorials on Duplicity. If you are just getting started with duplicity, I would recommend to head over to the first and second part to get a basic overview of duplicity and get GPG keys setup properly (this will not be covered in this post, but is required for the tutorial to work). You should also have a look at the duplicity overview post, which contains an overview of this series. The basic configuration from this post will be used as basis in this post to configure duplicity-backup.sh.

Backblaze

To start with, we will need an account at Backblaze. Once we’re setup (verified the account via phone) and have configured 2FA (you do use 2FA, don’t you?) we can get started. We’ll get 10G Storage for free, free upload and 1Gb free download, just for signing up. This will be enough to get started using backups, and evaluate if this is the right service.

As Backblaze offers a very good tutorial on how to get duplicity setup under Linux, I’ll not repeat these steps here.

Rather, we’ll jump right in and include Backblaze into the duplicity-backup.sh script, we used previously.

duplicity-backup.sh

The following will assume that Backblaze has been setup and tested successfully using the Backblaze tutorial.

Should you have problems with the above Tutorial and getting setup let me know in the comments down below and I’ll update this post to include these steps.

Single site Backup

To backup to Backblaze using the duplicity-backup.sh script we used previously, change DEST to the following to the script:

# DEST="b2://<accountid>:<Application key>@<bucket name>"
DEST="b2://431b5d5zd3ac:dad74350dabd8d9b47ca3bc7094c784339c8452d8f@duplicitytest"

Don’t even mind trying using the above line without inserting your own id/key - this is not my account (and a randomized key).

We now run the duplicity-backup.sh script.

./duplicity-backup.sh --config duplicity-backup.conf --backup

Please note that this method is not recommended as the backup is in only one place. Depending on the requirements, the following approach should be preferred.

Multi-site Backup

As explained in this article, we can simply add backup-locations by appending them to the configuration file.

Remember how we configured our DEST variable:

DEST='"multi:///home/matt/multiconfig.conf?mode=mirror&onfail=abort"'

This mirrors all backups to all configured sites, and fails if one is not available. Now, open the file configured above and insert the Backblaze configuration

[
 {
  "description": "Local disk test",
  "url": "file:///home/matt/backupmulti"
 },
 {
  "description": "Backblaze test",
  "url": "b2://431b5d5zd3ac:dad74350dabd8d9b47ca3bc7094c784339c8452d8f@duplicitytest"
 }
]

As I already had a backup from previous backups, we need to upload the existing backups first. This way, we won’t loose any backup-history. This can be accomplished by running the following command (please make sure to update both account-id, keys and bucket name to suit your needs)

# Insert required account-id and application key when asked
b2 authorize-account

cd <existingbackupdir>
# Sync the backup-folder to the duplicity-bucket "duplicitytest"
b2 sync . b2://duplicitytest/

This way, we keep our history as well.

Closing words

There are a a ton of of options for cloud backups. Backblaze is one of them (and for now, my backup provider of choice). The speed is good (something I complained about in my Hubic Tutorial). Also the security seems good, and people I trust security-wise like Troy Hunt trust Backblaze with their data.

In the end, it does not matter all that much which provider is used, as long as the backup is executed regularly, tested and implemented following the “3-2-1” rule:

3 total copies of the data - on 2 different mediums, at least 1 off site.

Full disclosure

Title photo credit: ChrisDag via photopin (license)


comments powered by Disqus