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.
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
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.
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.
Special thanks to Matthew Bentley for adding the Backblaze B2 support to duplicity.
Articles in this section
- How to use CTERA Storage Gateway with Backblaze B2
- Quickstart Guide for Commvault and Backblaze B2 Cloud Storage
- Quickstart Guide for NovaBackup and Backblaze B2 Cloud Storage
- Quickstart Guide for Catalogic DPX and Backblaze B2
- Quickstart Guide for Cloudcasa and Backblaze B2
- QuickStart Guide for DataIntell and Backblaze B2 Cloud Storage
- Quickstart Guide for Nirvashare and Backblaze B2
- Quickstart Guide for Configuring SoDA Data Management software to Backblaze B2
- Quickstart Guide for Kasten K10 and Backblaze B2
- Veeam VM Recovery from Backblaze B2