- Print
- DarkLight
Configure Backblaze B2 with Duplicity on Linux
- Print
- DarkLight
Duplicity is an open-source backup tool that supports encryption, compression, and data retention. Duplicity can store backup data in many destinations, including Backblaze B2 Cloud Storage. This guide helps you set up Duplicity and provides the commands to do a full backup and restore of a specific folder.
Enable a Backblaze B2 Account
Before you begin: You must have a Backblaze B2 Cloud Storage account. You can sign up here. If you already have a Backblaze account and the left navigation menu contains a B2 Cloud Storage section, your account is already enabled for Backblaze B2.
- Sign in to your Backblaze account.
- In the left navigation menu under Account, click My Settings.
- Under Enabled Products, select the checkbox to enable B2 Cloud Storage.
- Review the Terms and Conditions, and click OK to accept them.
Create a Bucket
Ensure that your bucket is set to Private.
- Sign in to your Backblaze account.
- In the left navigation menu under B2 Cloud Storage, click Buckets.
- Click Create a Bucket.
- Enter a name for your bucket.
Bucket names must be at least six characters and globally unique. A message is displayed if your bucket name is already in use. - Select a privacy setting: Private or Public.
Files that are in a private bucket require authentication to perform an action, for example, downloading. Public buckets do not require authentication so you can easily share files. You can change a bucket's privacy settings at any time. - If applicable, enable a Backblaze B2 server-side encryption key.
- Enable Object Lock to restrict a file from being modified or deleted for a specified period of time.
- Click Create a Bucket, and copy the value that is in the Endpoint field; you may need this value for other processes.
- Click Lifecycle Settings to control how long to keep the files in your new bucket.
Retrieve your Master Application Key and KeyID
- Sign in to your Backblaze account.
- In the left navigation menu under Account, click Application Keys.
- In the Master Application Key section, click Generate New Master Application Key.
- Click Yes! Generate Master Key.
Install or Update Duplicity
Duplicity is pre-installed on many Linux systems. However, a minimum version of 0.8.08 for Duplicity is recommended when paired with Backblaze B2.
To upgrade Duplicity on Ubuntu, Debian, and other Linux systems that support APT, enter the following commands in 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
Back Up Your Home Directory
To back up your home directory, use the following command, replacing your Backblaze B2 master application key, its associated keyID, and the bucket name:
$ duplicity ~ b2://[keyID]:[application key]@[B2 bucket name]
Duplicity creates an encryption key and performs a full backup on the initial backup. After the backup is complete, Duplicity displays stats about how much data was backed up and stored. Each subsequent run of Duplicity is faster because it runs only an incremental backup.
--------------[ 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
-------------------------------------------------
Restore a Folder from your Duplicity Backup
Enter the following command to restore a folder from your backup:
$ duplicity restore --file-to-restore [folder name from backup] b2://[keyID]:[application key]@[B2 bucket name] [restore path]
In this example, [folder from backup]
is the folder's name in your Duplicity backup, and the [restore folder]
is the folder on your filesystem where you want this folder to be restored.
Additional Resources
- Logan Marchione's guide on how to set up Duplictity and B2
This guide includes instructions about how to set up a GPG key, as well as a script that you can run daily to do full backups every 30 days. - Ubuntu's how to page for Duplicity
- Duplicity main page
GUI Resources
You can use the following GUIs with Duplicity:
- Duplicati is an open-source backup tool that supports Backblaze B2 and has a web-based GUI.
- Cloudberry, qBackup, and Duplicacy are commercial tools that include GUIs.