setup and backup

1 - install restic

2 - create repo for restic to store backups in

restic init --repo /path/to/repo init

3 - manual backup

restic --repo /path/to/storage backup /path/to/what/to/backup

4 - automate based on time interval

we can use cron here, but for unattended part of this to work we need to pass repo password

touch ~/.restic-env
echo export RESTIC_REPOSITORY="/path/to/storage" >> ~/.restic-backup
echo export RESTIC_PASSWORD="YOURPASSWORD" >> ~/.restic-backup
  • Alternatively store pass in file and pass to cron command crontab -e and paste the following to perform daily backups at 2 am 0 2 * * * /usr/bin/restic -r /path/to/backup/repository --password-file /path/to/password.txt backup /path/to/folder

  • (optional) store exclude pattern in a file

5 - remove old snapshots