2021-11-01

Restic

 01 Nov 2021  Snippets

Restic

Install Restic

Get latest binaries from https://github.com/restic/restic/releases/latest

# Example latest release is 0.12.1

wget https://github.com/restic/restic/releases/download/v0.12.1/restic_0.12.1_linux_amd64.bz2

bunzip2 restic_0.12.1_linux_amd64.bz2

mv restic_0.12.1_linux_amd64.bz2 /usr/bin/restic

chmod +x /usr/bin/restic

restic version
Export ENV Variables

Using Backblaze B2 as an example destination for repo:

export B2_ACCOUNT_ID='XXXXXXXXXXXXXXXXXXXXXXXXX'
export B2_ACCOUNT_KEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
export RESTIC_PASSWORD='XXXXXXXXXXXXXXXXXXXXXXXXXXX'

Don’t forget to run source .zshrc when done, or .bashrc if using Bash for the variables to become exposed to the current session.

Initialize Restic Repository
restic -r b2:target-bucket init
Create Excludes File

The example below resembles a .gitignore file’s contents because I use Restic to backup my repositories and I pulled the restic-excludes.txt file content from that use case:

# ~/restic-excludes.txt

.git
.bundle
.jekyll-cache
.jekyll-metadata
.log
.sass-cache
*.gem
*.lock
*.map
*.log
node_modules
_site
Create Backup

sh

restic -r b2:target-bucket --verbose backup /root/GitLab --exclude-file=/root/restic-excludes.txt
List Backups
restic -r b2:target-bucket snapshots
Restore Backup

restic -r b2:restic–code-paramdeo-com latest –target ~/GitLab

Restore Backup to Mount Point

Useful for browsing a backup, for instance if the mount target is ramfs:

mkdir /mnt/restic

restic -r b2:target-bucket mount /mnt/restic
Change Repository Password
restic -r b2:restic--code-paramdeo-com key passwd
Webmentions & Comments

Copyright © Paramdeo Singh. Made with ☕️ in Guyana. All Rights Reserved.

Last Site Build on Tue, 30 Nov 2021 19:17:38 -0500

1MB Club Badge

Paramdeo Singh Guyana

Riding the wave of consciousness in this treacherous mortal sea.

Technology Design Strategy Literature Personal Blogs