Millions of Linux installations around the world include duplicity, an open source backup tool which supports encryption, compression, data retention and many other powerful features. Duplicity can store backup data in many destinations, including Backblaze B2. This guide will help you get setup and give you the commands to do a full backup and restore of a specific folder.
Installation
While duplicity is pre-installed on many Linux systems, a minimum version of 0.8.08 for Duplicity is recommended when paired with B2.
The easiest way to upgrade on Ubuntu, Debian and other Linux systems that support apt is via the terminal:
$ duplicity --version duplicity 0.7.06
$ sudo add-apt-repository ppa:duplicity-team/ppa $ sudo apt-get update $ sudo apt-get --only-upgrade install duplicity
$ duplicity --version
duplicity 0.8.08
Create Backblaze account with B2 enabled
First, you have to create a Backblaze account and enable B2. If you already have a Backblaze account, login, visit "My Settings" and enable "B2 Cloud Storage" on your account under "Enabled Products"
Second, create an Private bucket in your B2 account.
Third, retrieve your Master Application Key and KeyID. You will need to specify these in duplicity to perform backups and restores.
Performing a backup of your home directory
While duplicity is a sophisticated tool with many features, getting started is very easy. For example, if you want to create a backup of your home directory, use the following command, replacing your Backblaze B2 master application key, its associated keyID, and the bucket name appropriately:
$ duplicity ~ b2://[keyID]:[application key]@[B2 bucket name]
On first run, duplicity will create an encryption key for you and run a full backup. After the backup is complete, duplicity will give you stats about how much was backed up and stored. Each subsequent run of duplicity will only do an incremental backup, which will be considerably faster.
--------------[ Backup Statistics ]-------------- StartTime 1503518136.97 (Wed Aug 23 12:55:36 2017) EndTime 1503518593.19 (Wed Aug 23 13:03:13 2017) ElapsedTime 456.22 (7 minutes 36.22 seconds) SourceFiles 456 SourceFileSize 2157364972 (2.01 GB) NewFiles 456 NewFileSize 2157364972 (2.01 GB) DeletedFiles 0 ChangedFiles 0 ChangedFileSize 0 (0 bytes) ChangedDeltaSize 0 (0 bytes) DeltaEntries 456 RawDeltaSize 2156938988 (2.01 GB) TotalDestinationSizeChange 1449185876 (1.35 GB) Errors 0 -------------------------------------------------
Restoring a folder from your duplicity backup
To restore a folder from your backup, use the following command:
$ duplicity restore --file-to-restore [folder name from backup] b2://[keyID]:[application key]@[B2 bucket name] [restore path]
The [folder from backup] is the folder's name in your duplicity backup. The [restore folder] is the folder on your filesystem where you want this folder to be restored.
Just specify the encryption passphrase you set above, and the folder will be restored.
What else can I do?
We got great inspiration from Logan Marchione's post on how to setup Duplicity and B2. It includes instructions on setup up your own GPG key, and a script you can run daily to do full backups every 30 days.
Other resources include Ubuntu's howto page for Duplicity and the duplicity man page.
I want a GUI. Where can I get a GUI?
There is a popular GUI for duplicity, Déjà Dup. While it does not support Backblaze B2 today, there has been some interest to implement this. If you'd like to see B2 support, make sure you share your interest.
Another open source backup tool that supports Backblaze B2 and has a web based GUI is Duplicati. There are commercial tools with GUIs too: Cloudberry, qBackup, and Duplicacy.
Special thanks to Matthew Bentley for adding the Backblaze B2 support to duplicity.
Articles in this section
- Quickstart Guide for Veeam 12 Direct-to-Cloud Backups to Backblaze B2 with Immutability
- Quickstart Guide for Offshoot and Backblaze B2
- Quickstart Guide for Files.com and Backblaze B2 Cloud Storage
- Quickstart Guide for Encoding.com and Backblaze B2 Cloud Storage
- Quickstart Guide for Mountain Duck and B2 Cloud Storage
- Quickstart Guide for Microsoft 365 Backup with MSP360 and Backblaze B2 (Multiple Instances)
- Quickstart Guide for Microsoft 365 Backup with MSP360 and Backblaze B2 (Single Instance)
- Quickstart Guide for Iconik and Backblaze B2 Cloud Storage
- Quickstart Guide for Cuttingroom and Backblaze B2 Cloud Storage
- Quickstart Guide for Catalogic DPXv and Backblaze B2