ScriptsApr 10, 2026·3 min read

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.

TL;DR
Restic provides encrypted, deduplicated backups to 20+ storage backends with fast incremental snapshots.
§01

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).

§02

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.

§03

How to use

  1. Install Restic via your package manager.
  2. Initialize a repository on your chosen backend.
  3. 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
§04

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
§05

Related on TokRepo

§06

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

Is Restic data encrypted by default?+

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.

How does Restic handle deduplication?+

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.

Can Restic back up to cloud storage?+

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.

How fast are incremental backups?+

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.

How does Restic compare to BorgBackup?+

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

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets