Configure Backblaze B2 with Duplicity on Linux
    • Dark
      Light

    Configure Backblaze B2 with Duplicity on Linux

    • Dark
      Light

    Article Summary

    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.

    1. Sign in to your Backblaze account.
    2. In the left navigation menu under Account, click My Settings.
    3. Under Enabled Products, select the checkbox to enable B2 Cloud Storage.
    4. Review the Terms and Conditions, and click OK to accept them. 

    Create a Bucket

    Ensure that your bucket is set to Private.

    1. Sign in to your Backblaze account.
    2. In the left navigation menu under B2 Cloud Storage, click Buckets.
    3. Click Create a Bucket.
    4. 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.
    5. 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.
    6. If applicable, enable a Backblaze B2 server-side encryption key.
    7. Enable Object Lock to restrict a file from being modified or deleted for a specified period of time.
    8. Click Create a Bucket, and copy the value that is in the Endpoint field; you may need this value for other processes.
    9. Click Lifecycle Settings to control how long to keep the files in your new bucket.

    Retrieve your Master Application Key and KeyID

    1. Sign in to your Backblaze account.
    2. In the left navigation menu under Account, click Application Keys.
    3. In the Master Application Key section, click Generate New Master Application Key.
    4. Click Yes! Generate Master Key.
    Notes
    Because your master app key is shown only when you generate it, save your master app key in a secure location if you plan to use it more than once.

    The term "master application key ID" was formerly called an "account ID." If you use an integration in which the terminology was not updated to reflect this change, the master application key ID works in place of your account ID. For a standard app key, you can use that key's keyID in place of an account ID.

    You can find your master app key ID on the Application Keys page.

    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

    GUI Resources 

    You can use the following GUIs with Duplicity:


    Was this article helpful?