Automated Home Server Backups Made Easy: Restic, Backrest, and Backblaze B2

Automated Home Server Backups Made Easy: Restic, Backrest, and Backblaze B2

Hello all,

Today, I’d like to discuss a crucial topic: backups. Backups are essential for protecting data, especially when you’re running a home server. For those of us building home servers, the journey is often one of constant expansion. You start with a few basic services, but soon you’re running more complex setups—like Vaultwarden for password management, this blog, a reverse proxy, and more. Getting everything to run smoothly takes time, and once it does, it’s easy to overlook backups. However, they’re vital to avoid losing important data due to unexpected failures.

We all know backups are important—but how do we actually go about setting them up?

After researching several options, I chose Restic for my home server. Restic is a powerful open-source backup tool designed for speed, security, and efficiency. It’s ideal for home server enthusiasts who want a reliable, secure, and easy-to-manage backup solution.

Why Restic?

Restic is packed with features that make it an outstanding choice for home servers:

  • Encryption: Restic encrypts data by default, ensuring that only you can access your backups.
  • Deduplication: It saves storage space by storing only unique data blocks, making backups faster and more efficient.
  • Flexible Storage Options: You can store backups locally or with various cloud providers like AWS S3, Backblaze B2, or even on your own server.
  • Incremental Backups: After the initial backup, Restic saves only the changes, optimizing backup times and storage use.
  • Cross-Platform Compatibility: It works on Linux, macOS, Windows, and other Unix-like systems.

With snapshot management, data integrity checks, and customizable retention policies, Restic lets you safeguard everything from family photos to critical server configurations without requiring excessive storage. It’s a reliable, straightforward backup solution for any home server.

Simplifying Backups with Backrest

While Restic is robust, it does involve command-line usage, which can be challenging. That’s where Backrest comes in—a graphical user interface (GUI) designed to make Restic backups more accessible. With Backrest, you can create, schedule, and restore backups without touching the command line.

Backrest enhances Restic with:

  • Intuitive GUI: A clean, easy-to-navigate interface for managing backups.
  • Seamless Restic Integration: Utilizes Restic’s secure and efficient backup capabilities.
  • Snapshot Management: Easily view, restore, or delete backups.
  • Automated Backups: Schedule regular backups to keep your data protected.
  • Cross-Platform Support: Available on Windows, macOS, and Linux.

Setting Up Backrest with Docker Compose

To deploy Backrest, you can use the following Docker Compose configuration:

services:
  backrest:
    image: garethgeorge/backrest:latest
    container_name: backrest
    hostname: backrest
    volumes:
      - /var/lib/backrest/data:/data
      - /var/lib/backrest/config:/config
      - /var/lib/backrest/cache:/cache
      - /var/lib:/userdata
      - /opt/stacks:/composedata
    environment:
      - BACKREST_DATA=/data
      - BACKREST_CONFIG=/config/config.json
      - XDG_CACHE_HOME=/cache
      - TZ=Europe/Berlin
    restart: unless-stopped
    ports:
      - 9898:9898

For more detailed guidance, check out the Backrest documentation.

Cloud Storage with Backblaze B2

For offsite backups, Backblaze B2 offers an affordable and user-friendly cloud storage solution. It’s known for its straightforward setup and unlimited backup option for personal computers, making it ideal for home server users.

Backblaze Key Features:

  • Unlimited Backup: Back up all your data without worrying about storage limits.
  • Easy Recovery: Restore files via a web interface or request a physical drive with your data.
  • Affordable Pricing: Budget-friendly plans, perfect for home or small business use.
  • File Versioning: Keep multiple versions of files for easy recovery.
  • Secure Storage: Data is encrypted both in transit and at rest.

Backblaze provides the first 10 GB of storage free, which is great for initial testing or lightweight backups.

Integrating Backrest with Backblaze B2

To get started with Backblaze B2 for your Restic backups:

  1. Create a B2 Bucket and Application Key from the Backblaze admin panel. These credentials will be used to configure your Restic repository.
  2. In Backrest, add a new repository by providing your B2_ACCOUNT_ID and B2_ACCOUNT_KEY. This setup will prompt for a password, which you can generate directly for Restic.
  3. Add a Backup Plan: Specify paths for configurations and any Docker Compose files you want to include in your backup. Set up a regular cron job for automated backups and define a retention policy to keep snapshots from past dates as needed.

Backrest also allows you to add hooks for receiving notifications about backup statuses, helping you stay on top of your data security.

In Conclusion

Running a home server is a rewarding experience, but don’t overlook backups! With tools like Restic and Backrest, combined with cloud storage from Backblaze B2, you can easily protect your data and ensure it’s safe from loss. Set up your backups today and stay secure out there!

Read more