Restic: Difference between revisions

From Leo's Notes
This page was last edited on 3 January 2022, at 06:17.
Initial Content
 
m Added categories and navbar
Line 54: Line 54:
}}
}}
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: <code>https://<namespace>.compat.objectstorage.<region>.oraclecloud.com</code>, where <namespace> is given under your bucket information and region is found in your dashboard's URL.
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: <code>https://<namespace>.compat.objectstorage.<region>.oraclecloud.com</code>, where <namespace> is given under your bucket information and region is found in your dashboard's URL.
{{Navbox Linux}}
[[Category:Linux]]
[[Category:LinuxUtilities]]

Revision as of 06:17, 3 January 2022

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

Download: https://github.com/restic/restic/releases/latest

Cheat sheet

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

Automate backups with cron

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

Define the following environment variables before running restic init.

export AWS_ACCESS_KEY_ID="***"
export AWS_SECRET_ACCESS_KEY="***"
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>.oraclecloud.com, where <namespace> is given under your bucket information and region is found in your dashboard's URL.