How to Set Up Automated Remote Backups with Restic and Backblaze B2

A local backup on an external hard drive protects you against accidental file deletion or hardware drive failure. However, a local backup cannot save your data from catastrophic events like house fires, flood damage, or targeted ransomware that encrypts all attached storage drives. True data survival requires adhering to the 3-2-1 Backup Rule: three copies of data, across two different media formats, with at least one copy stored off-site. Combining the open-source Restic backup utility with Backblaze B2 Cloud Storage delivers enterprise-grade encryption and deduplication for less than $1 per month.

Why Restic is Superior to Standard Cloud Sync Apps

Standard sync utilities (like Google Drive or Dropbox desktop clients) mirror file modifications instantly. If ransomware encrypts your documents, the encrypted garbage syncs immediately to the cloud, corrupting your remote files. Restic operates fundamentally differently:

  • Client-Side Zero-Knowledge Encryption: Every file block is encrypted locally using AES-256 before transmission. Backblaze possesses zero mathematical ability to decrypt your files.
  • Content-Defined Chunking & Deduplication: If you back up five duplicate copies of a 1GB video or slightly modify a 500MB database, Restic only stores the unique changed bytes, slashing storage bills and transfer times.
  • Immutable Snapshots: Backups are saved as discrete historical point-in-time snapshots. You can restore your system exactly as it existed three days, three weeks, or three months ago.

Step 1: Setting Up Backblaze B2 S3-Compatible Storage

  1. Create an account at Backblaze and navigate to B2 Cloud Storage → Buckets.
  2. Click Create a Bucket. Assign a unique name (e.g., my-secure-restic-vault-2026) and set encryption to Enabled.
  3. Navigate to Application Keys and generate a new Application Key with read/write access to your bucket. Copy your keyID and applicationKey.

Step 2: Initializing Your Encrypted Restic Repository

Install Restic on Windows (via winget install restic), macOS (brew install restic), or Linux (sudo apt install restic). Set your environment variables in your terminal:

export AWS_ACCESS_KEY_ID="your-key-id"
export AWS_SECRET_ACCESS_KEY="your-application-key"
export RESTIC_REPOSITORY="s3:s3.us-west-004.backblazeb2.com/my-secure-restic-vault-2026"
export RESTIC_PASSWORD="choose-a-strong-vault-password"

Initialize the encrypted remote repository:

restic init

Step 3: Executing Automated Deduplicated Backups

To back up your documents, photos, or project directories, run:

restic backup ~/Documents ~/Pictures --exclude="*.tmp" --exclude="node_modules"

Restic will scan the files, encrypt unique chunks, and stream them securely to Backblaze. Subsequent daily backups take mere seconds because only newly created or modified files are uploaded.

Step 4: Pruning Old Snapshots and Restoring Files

Automate retention policies to prune old snapshots and minimize cloud storage fees:

restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune

To verify or restore files, simply run restic restore latest --target /path/to/restore or use restic mount /mnt/backup to browse historical snapshots as a virtual drive.

FA

Written by Fahad Ali

Founder & Technical Editor

Fahad Ali is the founder and technical editor of Smart Guide Pulse. With a background in web systems, cloud infrastructure, and software workflows, he writes and curates step-by-step operating system troubleshooting guides, software reviews, and practical productivity tutorials.