Aller au contenu
GuidesSauvegardesIntermédiaire

Stratégie de sauvegarde serveur domestique qui fonctionne

Planifiez vos sauvegardes avec la règle 3-2-1, testez les restaurations et choisissez des outils comme Restic ou Borg.

par HomeServersGuide TeamMis à jour 3 novembre 20266 min de lecture

A hard truth: RAID is not a backup

RAID and ZFS protect against drive failure. They do nothing against the things that actually destroy data most often: accidental deletion, a bad update, ransomware, a corrupted app database, theft, or fire. Backups protect against all of those. If you take one thing from this guide: build backups before you need them. Read RAID explained for why redundancy and backup are different jobs.

The 3-2-1 rule

The time-tested standard:

  • 3 copies of your data,
  • on 2 different types of media/devices,
  • with 1 copy offsite.

For a homelab that typically means: the live data on your server, a backup on a NAS or separate disk, and an encrypted copy in the cloud or at another location. Modern advice adds a fourth idea: keep at least one copy offline or immutable, so ransomware or a compromised server can't delete or encrypt it.

Step 1: Decide what to back up

Not everything is equally precious. Sort your data into tiers:

  • Irreplaceable — family photos, documents, personal projects, password manager vaults. Back these up religiously, offsite.
  • Hard to recreate — service configs, databases (Nextcloud, Immich, Home Assistant), Docker Compose files. Back up regularly.
  • Replaceable — media you can re-acquire, caches, downloadable ISOs. Back up lightly or not at all.

Also back up the things people forget: container volumes, databases, your compose files (ideally in Git), router and switch configurations, DNS lists, and a written note of how to rebuild everything.

Step 2: Set recovery goals

Two numbers keep you honest:

  • How much data can you afford to lose? (RPO) A nightly backup means up to a day of changes may be lost.
  • How long can you be without the service? (RTO) A restore from a cloud archive can take hours or days for large data.

Photos need a different plan than a Home Assistant config. Match frequency and location to the answers.

Step 3: Understand snapshots vs. backups

  • Snapshots (ZFS/Btrfs/Proxmox) are instant, cheap rollback points — perfect for undoing a bad change. But they live on the same system, so a dead pool or stolen server takes them too.
  • Backups are independent copies on other media/locations.
  • Sync (Syncthing, cloud sync) mirrors changes, including deletions and corruption, so it's not a backup by itself.

Use snapshots for quick "oops" recovery, backups for real disaster protection.

Step 4: Pick your tools

  • Restic — fast, encrypted, deduplicated backups to local disks, SFTP, or cloud (S3, Backblaze B2). Excellent default, scriptable.
  • Borg — similar strengths with great compression and deduplication; pairs with BorgBase for hosted repos.
  • Duplicati — friendly web UI and scheduling for beginners.
  • Proxmox Backup Server — for whole-VM backups with dedup and verification.
  • ZFS send/receive — efficient replication of snapshots to another ZFS machine.
  • Syncthing — continuous sync between devices (not a backup on its own, but pairs well).

Step 5: Automate it

A backup you have to remember to run won't happen. Schedule it with a systemd timer or cron. A typical Restic flow:

#!/bin/bash
set -euo pipefail
 
# Back up important folders to Backblaze B2, encrypted
export RESTIC_REPOSITORY="b2:my-bucket:server"
export RESTIC_PASSWORD_FILE="/root/.restic-pass"
export B2_ACCOUNT_ID="..."
export B2_ACCOUNT_KEY="..."
 
restic backup /srv/config /srv/photos /srv/docker \
  --exclude-caches --exclude '*.tmp'
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
restic check --read-data-subset=5%
 
# Tell the monitor we succeeded
curl -fsS "https://kuma.example.com/api/push/TOKEN?status=up&msg=OK"

Run it with a systemd timer:

# /etc/systemd/system/backup.timer
[Timer]
OnCalendar=*-*-* 02:30:00
Persistent=true
 
[Install]
WantedBy=timers.target

Keep the credentials file readable only by root (chmod 600).

Step 6: Handle databases and containers properly

Copying a live database's files can produce a corrupt backup. Dump first:

# PostgreSQL in a container
docker exec postgres pg_dumpall -U postgres | gzip > /srv/backups/pg-$(date +%F).sql.gz
 
# MariaDB / MySQL
docker exec mariadb mariadb-dump --all-databases -uroot -p"$DB_PASS" > /srv/backups/mariadb.sql

Some apps need maintenance mode (as in the Nextcloud guide) or offer built-in backup tools (Immich, Home Assistant). Back up Compose files and .env files too; see Docker Compose best practices.

Step 7: Encrypt everything offsite

Any copy that leaves your home should be encrypted so a breach of the cloud provider doesn't expose your data. Restic and Borg encrypt by default — keep the passphrase somewhere safe and separate from the backups (a password manager plus a printed copy in a safe place), or you'll be locked out of your own data.

Step 8: Protect backups from ransomware and mistakes

If an attacker gets onto your server, they will look for backups. Reduce the risk:

  • Use append-only repositories or provider features such as object lock / versioning, so a compromised server can't erase history.
  • Give the server credentials that can add backups but not delete them, and prune from a different machine.
  • Keep one copy offline, such as a rotated external drive.
  • Don't mount backup shares permanently read-write on the machine being backed up.

Combine this with the basics in the security checklist.

Step 9: Test your restores

This is the step everyone skips. A backup is worthless until you've proven you can restore it. On a schedule (at least quarterly):

  1. Restore a few files to a scratch location and compare them.
  2. Restore a whole app or VM into an isolated environment and boot it.
  3. Confirm databases come back consistent.
  4. Write down how long it took.

Fix any surprises now, not during a real emergency.

Step 10: Monitor for silent failures

The worst backup is one that quietly stopped working months ago. Have your backup script:

  • Email or push a notification on failure.
  • Ping an Uptime Kuma push monitor on success — so a missing success also alerts you.
  • Report repository size, so you notice if it stops growing.

What it costs

Offsite storage is cheap for irreplaceable data. Typical photo-and-document sets of a few hundred gigabytes cost a few dollars per month on object storage. Encrypted, deduplicated backups of replaceable media aren't worth paying to store. Plan for restore costs too: some providers charge to download. See the storage planner to size your needs.

A practical blueprint

  • Snapshots hourly/daily on your ZFS or Proxmox host for quick rollback.
  • Restic nightly of configs, databases and irreplaceable files to a NAS.
  • Restic/Borg nightly (or weekly) of the same to encrypted cloud for offsite.
  • One offline or immutable copy, refreshed monthly.
  • Quarterly restore test and failure alerts wired up.
  • A written rebuild guide stored outside the server.

Common mistakes

  • Backups on the same disk or machine as the data.
  • No restore test, and no monitoring of failures.
  • Losing the encryption key.
  • Backing up live database files.
  • Assuming sync, RAID or snapshots are backups.

Next steps

Set up your first automated Restic job today, then layer in Proxmox Backup Server for whole-VM protection and snapshots via ZFS. Build a NAS with sensible redundancy in How to build your first NAS.

Articles connexes

TutorielsSauvegardesAvancé

Configurer les sauvegardes Proxmox

Planifiez des sauvegardes vzdump et stockez-les sur NAS ou PBS.

6 min de lecture
GuidesAutomatisationIntermédiaire

Home Server Monitoring: A Complete Guide

Monitor your homelab with Uptime Kuma, Prometheus and Grafana: what to track, sensible alert thresholds, SMART disk health, backup checks and how to avoid alert fatigue.

4 min de lecture
GuidesConteneursIntermédiaire

Docker Networking Explained for Home Servers

Bridge, host, macvlan and internal Docker networks explained: container DNS, publishing ports, reverse proxy patterns, firewall pitfalls and a troubleshooting checklist.

4 min de lecture