Hello,
I have a single PVE node with several VMs and lots of backups. In order to improve redundancy I wanted to mirror the local storage to a cloud provider.
As I didn't want to install any additional 3rd party tools I decided to go with rsync which comes by default with PVE.
For me the best solution was to first sync the local storage to the offsite_storage on my TrueNAS and from there to my cloud provider.
Since there was no good guide anywhere in the Proxmox forums I thought I would just share my tutorial.
I won't get into detail on how to set up the cloud sync task on TrueNAS as there are plenty of guides and a very good documentation.
https://www.truenas.com/docs/hub/tasks/scheduled/cloudsync/
Backup local_storage to offsite_storage on PVE (f.e. cifs)
On your NAS / Server
Notes
Testing the cron job
In order to test the behaviour of the command do the following.
Kind Regards
TheHellSite
I have a single PVE node with several VMs and lots of backups. In order to improve redundancy I wanted to mirror the local storage to a cloud provider.
As I didn't want to install any additional 3rd party tools I decided to go with rsync which comes by default with PVE.
For me the best solution was to first sync the local storage to the offsite_storage on my TrueNAS and from there to my cloud provider.
Since there was no good guide anywhere in the Proxmox forums I thought I would just share my tutorial.
I won't get into detail on how to set up the cloud sync task on TrueNAS as there are plenty of guides and a very good documentation.
https://www.truenas.com/docs/hub/tasks/scheduled/cloudsync/
Backup local_storage to offsite_storage on PVE (f.e. cifs)
On your NAS / Server
- Create an SMB/CIFS share called "offsite_storage" and create a new SMB user (f.e. proxmox) that has r/w access to that share.
- Mount the "offsite_storage" share: Datacenter --> Storage --> Add --> CIFS
- Create a new cron job using SSH+nano or using WinSCP / FileZilla. Use whatever you prefer, this guide will SSH + nano.
- SSH into your PVE.
nano /etc/cron.d/offsite_backup
- Insert the config below (adjust the time and command to your needs) and save the file.
Code:PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # sync backups to remote storage daily at 4 am. # local_storage remote_storage 0 4 * * * root rsync -hrt --delete /mnt/pve/data_ssd/dump /mnt/pve/offsite_backup/
- Restart cron:
systemctl restart cron
- Check that cron started without any errors:
systemctl status cron
Code:root@PVE:/mnt/pve/data_ssd# systemctl status cron ● cron.service - Regular background program processing daemon Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-03-19 13:07:28 CET; 33s ago Docs: man:cron(8) Main PID: 17371 (cron) Tasks: 1 (limit: 4915) Memory: 652.0K CGroup: /system.slice/cron.service └─17371 /usr/sbin/cron -f Mar 19 13:07:28 PVE systemd[1]: Started Regular background program processing daemon. Mar 19 13:07:28 PVE cron[17371]: (CRON) INFO (pidfile fd = 3) Mar 19 13:07:28 PVE cron[17371]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
- Done. The cron job should now run daily at 4 am.
Notes
Testing the cron job
In order to test the behaviour of the command do the following.
- Change the timer of the cronjob to run it every 15 minutes:
15 * * * *
- Restart cron:
systemctl restart cron
- Check that cron started without any errors:
systemctl status cron
- If the command does what is expected revert the changes to use the final command.
Kind Regards
TheHellSite
Last edited: