Restic is an open source backup program written in Golang and can run on Linux, Windows, and Mac.


Cheat sheet[edit | edit source]

Description Command
Initialize a new repository restic init
Backup files restic backup /path/to/files
Backup files using a file list restic backup --files-from=$filelist
Backup files with a specific tag restic backup --tag $tag /path/to/files
Show available snapshots restic snapshots
Restore a snapshot to the given destination restic restore $snapshotid -t $destination
Delete all snapshots and prune backend storage restic forget --prune
Delete all snapshots except a specific tag restic forget --keep-tag=$tag

To automate restic, you may want to pass in the repository password in the RESTIC_PASSWORD environment variable.

Setup[edit | edit source]

Automate backups with cron[edit | edit source]

Add a cronjob:

# crontab -e
## Add:
## */15 * * * * . ~/.restic.env ; /usr/local/bin/restic backup --files-from=/root/restic.files --tag automated 2>> ~/restic.err >> ~/restic.log

S3 compatible backend[edit | edit source]

Define the following environment variables before running restic init.

export AWS_ACCESS_KEY_ID="***"
export RESTIC_REPOSITORY="s3:https://s3-server/bucket-name"

On Oracle Cloud, you need to generate the AWS access key id and secret under Identity & Security -> Users -> your account -> Customer Secret Keys. The S3 repository follows this format: https://<namespace>.compat.objectstorage.<region>, where <namespace> is given under your bucket information and region is found in your dashboard's URL.