Self-Hosted Backups: Architecture, Tools, and Recovery
Self-hosted backups let you keep control of backup storage, encryption, retention, and recovery instead of delegating the entire system to a hosted provider. They are useful for home labs, small offices, developers, and anyone running a NAS or server with data that must remain available after a disk failure, mistaken deletion, ransomware incident, or total host loss. This guide explains the architecture behind self-hosted backups, the trade-offs between common tools, and a practical design that includes an independent copy and a tested restore path.
Why Self-Hosted Backups Are Being Discussed
Self-hosting has expanded beyond file sharing. A home server may now contain photo libraries, password-manager exports, virtual machines, application databases, and configuration files for many services. Losing the host can therefore mean losing both the data and the instructions needed to rebuild it.
Hosted backup services can be convenient, but they introduce recurring costs, provider-specific retention rules, upload limits, and a dependency on someone else’s access controls. Self-hosting moves more responsibility to the operator. You choose the storage location and software, but you must also manage updates, monitoring, encryption keys, off-site copies, and recovery tests.
The goal is not to make every component local. A strong self-hosted design often combines a local repository for fast restores with an encrypted repository at another location. The important boundary is that the backup system must remain usable when the primary server, network, or building is unavailable.
What Are Self-Hosted Backups?
A self-hosted backup is a backup workflow whose repository and control plane are operated by you or your organization. The repository may be an external disk, a second NAS, a server reached over SSH, or an object-storage bucket containing client-side encrypted data.
The word self-hosted describes ownership and operation, not a single product. Common implementations include:
- A workstation backing up to a NAS over the local network.
- A NAS sending encrypted, versioned snapshots to a second site.
- A server writing application-aware dumps to local disk and copying them to an off-site repository.
- A small backup server exposing an S3-compatible object-storage endpoint for other machines.
The backup application usually reads source files, divides them into chunks, compresses and encrypts them, and stores metadata that describes snapshots. Later runs can reuse unchanged chunks. This is different from a plain mirror: a mirror reflects current state, while a versioned backup can preserve earlier states after a file is deleted or encrypted. For virtual machines and containers managed by Proxmox, Proxmox Backup Server provides this repository model with guest-aware scheduling and restore operations.
The Problem Self-Hosting Solves
Redundancy is not the same as backup. RAID, a ZFS mirror, or a second disk can keep a service online after one drive fails, but they may reproduce accidental deletions or ransomware encryption. A snapshot on the same host is also vulnerable if the host is stolen, destroyed, compromised, or administratively misconfigured. The Btrfs vs ZFS comparison explains why filesystem snapshots and redundant storage need a separate recovery plan.
A useful backup design separates several failure domains:
- Source failure: the computer, VM, database, or application being protected fails.
- Storage failure: a disk, filesystem, NAS pool, or backup repository becomes unreadable.
- Operator failure: a file is deleted, a bad deployment overwrites data, or credentials are misused.
- Security failure: an attacker gains access and attempts to delete or encrypt recovery copies.
- Site failure: fire, theft, flood, or a long network outage affects the entire location.
The CISA ransomware guidance recommends maintaining offline, encrypted, and regularly tested backups as part of ransomware resilience. A self-hosted system can meet those goals, but only if at least one copy is isolated from the source and recovery is exercised rather than assumed.
How a Self-Hosted Backup System Works
A practical system has five layers:
- Source layer: files, application data, databases, VM images, and service configuration.
- Consistency layer: quiescing an application, creating a database dump, or using a filesystem snapshot so the captured state is usable.
- Backup engine: chunking, deduplication, compression, encryption, indexing, retention, and repository checks.
- Repository layer: local disk, NAS, SSH server, removable media, or object storage.
- Operations layer: scheduling, alerts, access controls, restore documentation, and periodic recovery tests.
These layers should not be collapsed into one command. For example, copying a live database directory may produce files that exist but cannot be restored consistently. Export the database with its native tool, back up that export, and document how to import it. Likewise, a container image can recreate software but usually does not contain the persistent volume, database, secrets, or configuration that make the service useful.
| Approach | Strength | Main limitation | Appropriate use |
|---|---|---|---|
| File synchronization | Simple and fast for current files | Deletion and corruption can propagate | A second copy of non-critical working data |
| Filesystem snapshots | Fast point-in-time local recovery | Often tied to the same storage system | Short retention and quick rollback |
| Versioned repository | Keeps historical states and can deduplicate | Requires repository metadata and a restore workflow | Documents, photos, source code, and server data |
| Disk or VM image | Captures an entire machine state | Large, hardware- or hypervisor-specific restores | Bare-metal or virtual-machine disaster recovery |
| Database-native export | Preserves application-level consistency | Must be recreated and tested separately | PostgreSQL, MySQL, and other databases |
The restic introduction describes a repository model with snapshots, encrypted data, and multiple storage backends. BorgBackup follows a similar versioned, deduplicating approach and is particularly common with local or SSH-accessible repositories. Neither tool removes the need to protect repository access or maintain a separate failure domain.
Choosing the Repository and Tool
Start with recovery requirements rather than a favorite tool. A local USB disk offers fast recovery and can be disconnected when not in use. A second NAS enables scheduled network backups and larger retention windows. An encrypted object-storage repository provides geographic separation, but restores depend on internet bandwidth and provider availability.
| Tool or method | Encryption model | Storage targets | Best fit |
|---|---|---|---|
| Restic | Client-side encrypted repository | Local paths, SFTP, S3-compatible storage, and others | Cross-platform scripts and off-site copies |
| BorgBackup | Encrypted, deduplicated repository | Local paths and remote Borg/SSH repositories | Linux servers and efficient filesystem backups |
| ZFS send/receive | Dataset-level replication; encryption depends on dataset design | Another ZFS system | ZFS-to-ZFS replication and fast snapshots |
| Rsync | No repository encryption or history by itself | Local or SSH paths | Simple mirrors when combined with snapshots and separate retention |
| Application-native tools | Varies by application | Filesystem or remote storage | Databases and services that need consistent exports |
Restic and Borg are repository tools, not complete operations platforms. They do not automatically decide which databases to dump, which files to exclude, who receives alerts, or whether a restore succeeded. A systemd timer, cron job, Task Scheduler, or NAS scheduler can run the workflow, but the job should return an error when a backup or verification step fails.
For ZFS datasets, snapshots, and incremental transfers between hosts, see ZFS Snapshots and Replication. Replication can be one layer in a self-hosted backup design, but a protected failure-domain copy and restore tests are still required.
A Practical Self-Hosted Architecture
For a small home server, use three tiers:
- Primary data: the live NAS or server dataset.
- Local recovery copy: a versioned repository on a separate disk or second machine in the same location.
- Off-site recovery copy: an encrypted repository at another physical location, preferably with retention or immutability controls.
This resembles the 3-2-1 rule: at least three copies, on two kinds of storage, with one copy off-site. Keep the local copy for quick recovery, but do not count a mirror or snapshot as the only independent backup. If the local repository is writable from the production host, an attacker who compromises that host may be able to delete it. Use a restricted backup account, separate credentials, append-only or immutable repository features where available, and a removable or offline copy for especially important data.
Separate data by recovery value. Personal documents and photos may need frequent versioned backups. Container caches and downloaded media may only need a rebuild procedure. Secrets and encryption keys require a separate recovery plan: a backup that cannot be decrypted is not a successful backup, but storing the only key beside the ciphertext defeats the threat model.
Getting Started with Restic
The following example creates an encrypted local repository, backs up a directory, checks repository integrity, lists snapshots, and restores a test copy. Run it on a Linux host with the repository mounted on a different disk from the source.
export RESTIC_REPOSITORY=/mnt/backup/restic-repository
export RESTIC_PASSWORD_FILE=/etc/restic/repository-password
# Run once, after creating and protecting the password file.
restic init
# Back up source data with an explicit exclusion file.
restic backup /srv/data --exclude-file /etc/restic/excludes.txt --tag nightly
# Confirm snapshots and check repository structure.
restic snapshots
restic check
# Restore the latest snapshot into a temporary directory.
restic restore latest --target /var/tmp/restic-restore-test
Protect the password file with restrictive permissions and store an emergency copy of the repository password in a separate, controlled location. Do not place secrets directly in a shell script committed to a repository. For an off-site S3-compatible target, configure the provider’s endpoint and credentials through the environment or a secret manager, then run the same repository checks.
The command is only the backup engine. Before it runs, export databases and pause or snapshot applications that need a consistent state. After it runs, inspect the exit status and send an alert on failure. A simple schedule might run application exports nightly, local backups hourly for critical files, and off-site synchronization daily. Retention should include short-term daily versions and less frequent weekly or monthly versions according to the data’s recovery needs.
Security and Maintenance
Self-hosted repositories are valuable targets. Apply these controls:
- Do not expose the backup service directly to the public internet when a VPN or private network is sufficient.
- Use a dedicated backup identity with the minimum read or write permissions needed.
- Keep repository credentials and encryption keys separate from the production host.
- Encrypt data before it leaves a trusted machine when the remote operator should not read it.
- Restrict deletion rights, and use offline, append-only, or immutable storage for at least one copy.
- Patch the backup host and monitor disk health, capacity, failed jobs, and repository checks.
- Record retention rules, exclusions, credentials ownership, and recovery commands in a runbook.
Encryption creates an operational obligation. Test that the password, key material, and tool version are available before a disaster. If the backup is client-side encrypted, a storage administrator may be unable to help recover it. Keep a documented key-recovery procedure without storing the key in the same account that can delete the repository.
Restore Testing and Troubleshooting
A successful backup job proves only that a program completed. A restore test proves that the data, metadata, credentials, and instructions work together. Start with a small file restore, then periodically restore an entire service into an isolated directory or temporary host. For databases, import the dump and run a query. For a VM, boot the restored image or validate it with the hypervisor’s tooling.
Measure recovery against two goals:
- Recovery point objective (RPO): how much recent data can be lost.
- Recovery time objective (RTO): how long the service may remain unavailable.
If restores are slow, investigate repository location, network bandwidth, indexing, and the size of the restore scope. If jobs fail, check permissions, expired credentials, full disks, clock drift, and connectivity before changing retention or disabling verification. If a repository check reports corruption, preserve the repository, stop pruning, and follow the tool’s recovery documentation rather than repeatedly writing to the damaged storage.
Common Misconceptions
“RAID means the data is backed up”
RAID improves availability when a drive fails. It does not provide historical versions, off-site protection, or recovery from deletion and malware. A separate versioned repository is still required.
“A snapshot is always a backup”
A snapshot on the same pool is useful for short-term rollback, but it shares the pool’s failure and access boundaries. Treat it as one recovery layer, not the entire backup plan.
“The backup is safe because it is encrypted”
Encryption protects confidentiality, not availability. An encrypted repository can still be deleted, corrupted, or made unusable by a lost password. Protect the repository, test integrity, and rehearse key recovery.
Related Articles
- Backup Strategy Best Practices covers RPO, RTO, retention, and backup testing across environments.
- Build Your First NAS explains the storage hardware and filesystem choices behind a local backup target.
- TrueNAS SCALE Guide covers datasets, applications, snapshots, and recovery planning on a NAS platform.
- Zero-Knowledge Backup Solutions examines client-side encryption and key-management trade-offs.

