Restic — Fast & Secure Encrypted Backup Program
Restic is a modern backup program with encryption, deduplication, and support for 20+ storage backends. Single binary, fast incremental backups, and easy restores.
What it is
Restic is an open-source backup program that encrypts all data by default, deduplicates across snapshots, and supports over 20 storage backends including local disk, SFTP, S3, Google Cloud Storage, Azure Blob, and Backblaze B2. It ships as a single binary with no dependencies.
Restic targets system administrators, developers, and anyone who needs reliable automated backups. Its design philosophy prioritizes security (AES-256 encryption), efficiency (content-defined chunking for deduplication), and simplicity (one binary, clear CLI).
How it saves time or tokens
Restic's incremental backups only transfer changed data, making subsequent backups after the initial one finish in seconds for typical workloads. Deduplication across snapshots means storage costs stay low even with frequent backups. The uniform CLI works the same regardless of backend, so switching from local to S3 storage requires changing one parameter.
How to use
- Install Restic via your package manager.
- Initialize a repository on your chosen backend.
- Run backup and restore commands.
# Install
brew install restic # macOS
sudo apt install restic # Debian/Ubuntu
# Initialize a repository
restic init --repo /backup/my-repo
# or with S3
export AWS_ACCESS_KEY_ID=xxx
export AWS_SECRET_ACCESS_KEY=xxx
restic init --repo s3:s3.amazonaws.com/my-bucket
# Backup a directory
restic -r /backup/my-repo backup /home/user/documents
# List snapshots
restic -r /backup/my-repo snapshots
# Restore a snapshot
restic -r /backup/my-repo restore latest --target /tmp/restore
Example
# Automated daily backup with retention policy
#!/bin/bash
export RESTIC_REPOSITORY=s3:s3.amazonaws.com/my-backups
export RESTIC_PASSWORD_FILE=/etc/restic-password
# Backup
restic backup /var/www /etc /home \
--exclude='*.log' \
--exclude='.cache'
# Prune old snapshots: keep 7 daily, 4 weekly, 12 monthly
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune
Related on TokRepo
- DevOps tools — Infrastructure and operations tools
- Self-hosted solutions — Self-hosted infrastructure for data management
Common pitfalls
- Losing the repository password means losing all backups permanently. Restic has no password recovery. Store the password securely in a password manager and test restores regularly.
- The forget command without --prune removes snapshot references but does not free disk space. Always run forget with --prune to actually reclaim storage.
- First backup of large datasets takes significant time and bandwidth. Schedule initial backups during off-peak hours.
Frequently Asked Questions
Yes. Restic encrypts all data with AES-256 before it leaves your machine. The repository password is the encryption key. Even if someone gains access to your storage backend, they cannot read the backup data without the password.
Restic splits files into variable-length chunks using content-defined chunking (CDC). Identical chunks across files and snapshots are stored only once. This means if you have 10 snapshots of a file that changed slightly, only the changed chunks are stored, not 10 full copies.
Yes. Restic supports Amazon S3, Google Cloud Storage, Azure Blob Storage, Backblaze B2, MinIO, and any S3-compatible storage. It also supports SFTP, REST server, and local filesystem. The CLI syntax is the same regardless of backend.
After the initial full backup, incremental backups only scan for and transfer changed files. For typical workloads with small daily changes, incremental backups complete in seconds to minutes. Restic uses file metadata (mtime, size) to quickly identify unchanged files.
Both provide encrypted, deduplicated backups. Restic supports more remote backends natively (S3, GCS, Azure). BorgBackup has better compression options and slightly better deduplication ratios. Restic is simpler to set up for cloud storage; BorgBackup is more efficient for local and SFTP backends.
Citations (3)
- Restic GitHub— Restic is a fast, secure, and efficient backup program
- Restic Documentation— Restic documentation for installation, backends, and usage
- Restic Blog— Content-defined chunking for efficient data deduplication
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.