Tutorial: remote backup of local Cloudron backup snapshots with restic / rclone
necrevistonnezr last edited by necrevistonnezr
This is what I use for remote backups of my local Cloudron backup snapshots (done by rsync) via restic / rclone to Onedrive.
restic is a robust backup solution for incremental, encrypted, mountable(!) backups to local and remote storage. rclone, an equally robust sync software, is just a "transporter tool" that expands the available remote storages by a lot.
Maybe it can be a starting point and some inspiration for your personal needs.
- rclone: https://rclone.org/docs/
- restic: https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#other-services-via-rclone
- ssmtp: https://wiki.archlinux.org/title/SSMTP
- Install tools above via apt
- afterwards update to latest version (repo versions are old):
sudo restic self-update && sudo rclone selfupdate
- Enter an interactive setup process via
- in my case I use Onedrive as it has 1TB of space coming with my Office 365 subscription
- for the rest of this summary, we assume you gave it the repository name "REPOSITORY"
- details at https://rclone.org/commands/rclone_config/
- set up a backup repository
restic -r rclone:REPOSITORY init
- for a subfolder on onedrive just use
restic -r rclone:REPOSITORY:subfolder init
- save password that you gave the repository in file
- details at https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#other-services-via-rclone
- for receiving backup results, otherwise not needed
- See https://wiki.archlinux.org/title/SSMTP
Cloudron Backup settings
- Provider: mountpoint
/media/CloudronBackup(<-- obviously adjust to your settings)
- this creates a snapshot at
/media/CloudronBackup/snapshotfor the current backup
- Storage Format: rsync
- Adjust schedule and retention to your liking
Backup, Prune and Check scripts
restic-cron-backup.sh: The actual backup
#!/bin/bash d=$(date +%Y-%m-%d) if pidof -o %PPID -x “$0”; then echo “$(date “+%d.%m.%Y %T”) Exit, already running.” exit 1 fi restic -r rclone:REPOSITORY:subfolder backup /media/CloudronBackup/snapshot -p=/home/USER/resticpw restic -r rclone:REPOSITORY:subfolder forget --keep-monthly 12 --keep-weekly 5 --keep-daily 14 -p=/home/USER/resticpw restic -r rclone:REPOSITORY:subfolder check --read-data-subset=2% -p=/home/USER/resticpw exit
First line does the backup (incremental, encrypted), second line is the backup retention, third line checks a random 2 % of all data for errors.
Note that I only backup the
/snapshotfolder as all versioning is done by restic.
restic-cron-prune.sh: Pruning unused files in the backup
#!/bin/bash d=$(date +%Y-%m-%d) if pidof -o %PPID -x “$0”; then echo “$(date “+%d.%m.%Y %T”) Exit, already running.” exit 1 fi restic -r rclone:REPOSITORY:subfolder prune -p=/home/USER/resticpw exit
removes unused data from the repository, I run this once a week
restic-cron-check.sh: thorough health check of the backups
#!/bin/bash d=$(date +%Y-%m-%d) if pidof -o %PPID -x “$0”; then echo “$(date “+%d.%m.%Y %T”) Exit, already running.” exit 1 fi restic -r rclone:REPOSITORY:subfolder check --read-data -p=/home/USER/resticpw exit
checks all data for errors, I run this once a week
30 2 * * * sh /home/USER/restic-cron-backup.sh | mailx -s "Restic Backup Results" firstname.lastname@example.org 1 5 1 * * sh /home/USER/restic-cron-prune.sh | mailx -s "Restic Prune Results" email@example.com 1 8 1 * * sh /home/USER/restic-cron-check.sh | mailx -s "Restic Full Check Results" firstname.lastname@example.org
Backup daily at 2:30, prune and check once a week. Receive results to specified mail
Just to be complete: You can mount restic backups locally like
restic -r rclone:REPOSITORY:subfolder mount /media/resticmount/ -p=/home/USER/resticpw && cd /media/resticmount
/media/resticmount/to your settings; allows you to browse and copy from full snapshots for each backup
For listing all available snapshots use
restic -r rclone:REPOSITORY:subfolder snapshots -p=/home/USER/resticpw
timconsidine last edited by
robi last edited by
Becoming fan of https://ntfy.sh :
Nice find, that's totally self-hostable, you should add it to the list!
We had several instances where we needed a way to have notifications for cloudron apps/events. This would do the trick!
It can also be made a feature request for box notifications to support an API or curl call for admins.
timconsidine last edited by
@robi I've been meaning to have a go at packaging it.
But I stumbled on something (I forget what).
Will try again.
And will open a wishlist for someone more talented than me to have a crack.
necrevistonnezr last edited by
added command to list all available snapshots to original post