APNIC 56 Network Automation tutorial
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Backup & restore

export.sh

#!/bin/bash

# Script to export specific volume

docker run --rm -v $1:/data -v $(pwd):/dest ubuntu:20.04 tar cvzf /dest/$1.tar /data

import.sh

#!/bin/bash

# Script to import specific volume
# Usage ./vimport volume-name volume-dump.tar
docker run --rm -v $1:/dest -v $(pwd):/source ubuntu:20.04 bash -c "cd /dest && tar xvf /source/$2 --strip 1"

Restic basic commands

Create password file (password to ensure backups are encrypted at rest)

echo "PASSWORD-HERE" > ~/.restic_pass 

Create repository

Command syntax here is:

restic -p -r rclone:: init


restic -p ~/.restic_pass -r rclone:backblaze:btnog10-demo init

Trigger backup

restic -p ~/.restic_pass -r rclone:backblaze:btnog10-demo backup /home/a01/smokeping /home/a01/librenms

Check snapshots

restic -p ~/.restic_pass -r rclone:backblaze:btnog10-demo snapshots

Restore latest backup

restic -p ~/.restic_pass -r rclone:backblaze:btnog10-demo restore latest --target /home/a01/restored-data