Backblaze B2 Backups with Restic


This will walk you through setting up encrypted backups using Backblaze B2 and the Restic app on the client. All run through the terminal. Restic Docs Backblaze Sign In

Keep in mind that this is a file level backup, not a block level backup. Things like VM images, encrypted containers, etc will cause massive bandwidth usage and isn’t the appropriate solution for those. Really any large binary file that changes frequently shouldn’t use this method.

Setup Backup

Recommendation: Customize the Caps and Alerts page to your liking to avoid unexpected cost.

Create a B2 bucket on Backblaze, and get the Bucket ID.

Go to the App Keys section and create a new app key with access to your bucket.

Restic uses environment variables for account access. Export these environment variables (also known as keyID and applicationKey): export B2_ACCOUNT_ID={ID} export B2_ACCOUNT_KEY={KEY}

Initialize the Restic repository: restic -r b2:{BUCKET NAME}:{REMOTE REPO PATH} init

You will now enter an encryption key for this backup. Keep this safe. You can’t recover your data without this.

Begin the backup: restic -r b2:{BUCKET NAME}:{REMOTE REPO PATH} --verbose backup {LOCAL PATH TO BACKUP FROM}

Viewing Backup History

View snapshot history with: restic -r b2:{BUCKET NAME}:{REMOTE REPO PATH} snapshots

Restoring Backup

Note: I have not fully tested this

Use this to restore a remote backup to your local computer. Use the ID found with the above snapshots command.

restic -r b2:{BUCKET NAME}:{REMOTE REPO PATH} restore {ID} --target {LOCAL PATH TO RESTORE TO}

Viewing Backup Data / Mounting Backup

Use the mount option to restore only certain files, or view that the backup is working properly.