---
title: Simple Sophisticated Backup Strategy
description: When simple beats complex and a case for not reinventing the wheel.
date: 2026-05-29
period: '2023-2026'
thumbnail:
  src: ./_assets/backup.png
  alt: Placeholder thumbnail for the backup container post.
links:
  - label: Source
    url: https://git.schmelczer.dev/andras/backup-container
  - label: Container image
    url: https://git.schmelczer.dev/andras/-/packages/container/backup-container
article:
  tags: ['systems', 'tools']
  stack: ['Bash', 'BorgBackup', 'BTRFS', 'Alpine', 'Docker', 'SSH', 'zstd']
  scale: One container, multiple targets per host, four years of restored incidents
---

There's merit to keeping systems simpler the more critical they are. More precisesly, we must keep them easily understandable by building on solid foundations and only adding on top the most necessary extra logic.

A good example of this is my home server's backup. I ran various databases, even when I aim to mostly use sqlite, there are multiple postgres instances, redis, message queues, etc. Who doesn't like time machine like backups which allow granular file history? To achieve this, we need frequent backups, my setup uses an hourly cadence. However, we can't shut down the entire stack every hour to back it up. So the only solution is to backup everything live.

I could've gone down the rabbit hole of using each database's dedicated backup mechansim, however, that would've been everyhing but simple. So instead I rely on the DB's crash recovery mechanism being solid.

With the above context, I can now reveal that the backup container is just a short shell script that takes a btrfs snapshot (all container volumes are mounted from a btrfs subvolume) and then feeding into borg which handles incrementality and deduplication. The backup script supports configuring borg to run against multiple remote backup servers, gracefully handle failures, and to maintain a healthcheck status in case human intervention is needed.

I've been using this for 4 years now and I restored various files and folders and did two full disaster recoveries. These were enough to convince me of the soundness of borg, btrfs, and my backup configuration. That's why I don't think I will migrate away from this method any time soon.
