Restic is nice command line application to backup and restore your data.
I have chosen restic years ago because:
- It works on windows.
- It has plenty of supported targets that can be “dummy” storages (S3, SSH connected drive…)
- Works nicely out of the box and I can understand circa how
- Encrypts backup
I am currently using this to back up to Hetzner S3 Compatible storage:
#!/bin/bash
export AWS_ACCESS_KEY_ID=[XXX]
export AWS_SECRET_ACCESS_KEY=[YYY]
# this is repo initialization
#restic -r s3:https://fsn1.your-objectstorage.com/[BUCKET] init
# mounting, this mostly end with error, that it is already mounted
mount /mnt/Pool
# backup
restic -r s3:https://fsn1.your-objectstorage.com/[BUCKET] --password-file=[PATH_TO_REPO_PASSWORD] --verbose \
backup /mnt/Pool/Gold
# remove old snapshots
restic -r s3:https://fsn1.your-objectstorage.com/[BUCKET] --password-file=[PATH_TO_REPO_PASSWORD] --verbose \
forget --keep-last=60 --keep-daily=60 --keep-weekly=60 --keep-monthly=60 --keep-yearly=60 --prune
and this to back up to my NAS:
#!/bin/bash
mount /media/Cedar
#restic -r /media/Cedar/[BACKUP_NAME] init
mount /mnt/Pool
#restic -r /media/Cedar/[BACKUP_NAME] --password-file=[PATH_TO_REPO_PASSWORD] --verbose \
# snapshots
restic --r /media/Cedar/[BACKUP_NAME] --password-file=[PATH_TO_REPO_PASSWORD] --verbose \
backup /mnt/Pool/Gold
restic --r /media/Cedar/[BACKUP_NAME] --password-file=[PATH_TO_REPO_PASSWORD] --verbose \
backup /mnt/Pool/Silver
restic -r /media/Cedar/[BACKUP_NAME] --password-file=[PATH_TO_REPO_PASSWORD] --verbose \
forget --keep-last=60 --keep-daily=60 --keep-weekly=60 --keep-monthly=60 --keep-yearly=60 --prune
Restic does not schedule anything, so I have those commands running three times per day trough crontab.