LinuxCommandLibrary

restic

Fast and secure deduplicated backup tool

TLDR

Initialize a repository

$ restic -r [/path/to/repo] init
copy
Backup a directory
$ restic -r [/path/to/repo] backup [/path/to/data]
copy
List snapshots
$ restic -r [/path/to/repo] snapshots
copy
Restore from latest snapshot
$ restic -r [/path/to/repo] restore latest --target [/path/to/restore]
copy
Restore specific snapshot
$ restic -r [/path/to/repo] restore [snapshot_id] --target [/path/to/restore]
copy
Check repository integrity
$ restic -r [/path/to/repo] check
copy
Remove old snapshots (keep last 7 daily)
$ restic -r [/path/to/repo] forget --keep-daily [7] --prune
copy
Backup to S3
$ restic -r s3:s3.amazonaws.com/[bucket_name] backup [/path/to/data]
copy
Mount snapshots as filesystem
$ restic -r [/path/to/repo] mount [/mnt/restic]
copy

SYNOPSIS

restic [global options] command [options] [arguments]

DESCRIPTION

restic is a fast, secure, and efficient backup program. It creates encrypted, deduplicated snapshots of your data to local or remote repositories including local disk, SFTP, S3, Azure, Google Cloud Storage, and more.
Each backup creates a snapshot containing the state of the files at that point in time. Restic uses content-defined chunking for deduplication, meaning identical data is only stored once across all snapshots. All data is encrypted with AES-256.
Restore operations can target the entire snapshot or specific files. The mount command allows browsing snapshots as a FUSE filesystem.

PARAMETERS

-r repo, --repo repo

Repository location.
-p file, --password-file file
File containing repository password.
--verbose
Verbose output.
init
Initialize a new repository.
backup
Create a new snapshot.
restore
Extract files from a snapshot.
snapshots
List all snapshots.
forget
Remove snapshots (needs --prune to free space).
prune
Remove unreferenced data.
check
Verify repository integrity.
mount
Mount repository as FUSE filesystem.
--exclude pattern
Exclude files matching pattern.
--keep-last n
Keep last n snapshots.
--keep-daily n
Keep n daily snapshots.

CAVEATS

Repository password cannot be recovered if lost. Initial backup is slow (subsequent ones are fast due to deduplication). Forget without prune doesn't free space. Some backends require credentials via environment variables.

HISTORY

restic was created by Alexander Neumann in 2014 as a modern backup solution addressing shortcomings of existing tools. Written in Go, it was designed with security, deduplication, and cloud storage support as primary goals. The project gained popularity for its simplicity and reliability, becoming a recommended alternative to tools like duplicity.

SEE ALSO

duplicity(1), borg(1), rsync(1), rclone(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community