Backup and Restore to network?

I have tried the backup and restore and it works fine with a usb drive.
Would it be possible to add support for a network target?
Like running a rsync server on a Synology or similar?

Databeredning
Thanks for your request.

Since we are using rsync anyway, this is a reasonable request. I added it to GitHub: https://github.com/Fourdee/DietPi/issues/2364

Could not decide whether to comment here or on GitHub, decided here as it might be a different feature request.

Could the backup create a compressed archive that could be saved to an off device location (samba share, rsync, USB device, cloud file storage)?

[edit] this would then need a facility to import a compressed archive to restore from.

Could there be a schedule function for backup as well so backups are taken at a regular interval/specific time?

Is the backup effectively a shadow copy of the whole system?

Indeed we had a feature request about this on GitHub: https://github.com/Fourdee/DietPi/issues/816
Result as you can see, is that this is not something that will be implemented into DietPi-Backup, there are too many downsides and nearly no advantages, since the system itself usually does not take much disk space. If your really need this, I would go with a third party solution that allows incremental compressed backups, e.g.: https://github.com/borgbackup/borg

This on the other hand is something easy to implement with plain rsync. Open request: https://github.com/Fourdee/DietPi/issues/2364
Note that you can already sync to most of the mentioned destinations, since samba/FTP/NFS mounts and USB drives can be chosen as destination. Only using the plain file transfer protocol, e.g. for SFTP/SCP or FTP without mount, via rsync is not yet possible, but as said easy to implement.

Another open request in the pipe: https://github.com/Fourdee/DietPi/issues/2051

So finally, besides having backups stored compressed, all this is planned. Then problem is, most likely we will implement this via a larger rewrite and merge of the two scripts dietpi-sync and dietpi-backup. dietpi-sync allows scheduled sync via cron job while dietpi-backup allows backup & restore. Besides that both do moreless the same. We aim to merge them to have a more universal sync script that allows multiple sources and destinations (including remote systems, using the native rsync feature for this), forward- and backwards sync, enable/disable automatic schedule for them, and besides, allow to keep multiple backup instances: https://github.com/Fourdee/DietPi/issues/1785

But yeah, it’s a larger project between at least one other larger project about DietPi-LetsEncrypt/HTTPS.

Thanks for the detailed reply.

To be clear, I was not suggesting replacing the rsync backup method (which is excellent), more I wanted to be able to create a tar zipped archive that could be easily moved off device. By using tar after the backup rsync, and also utilising the update flag this could be relatively painless.

I just did exactly this from the command line and I will probably try to automate it to follow on from a dietpi-backup. It is the old 3-2-1 backup; on device - off device - off premises. I will setup a test machine and see if I can restore the tar into the backup folder and then restore the diet-pi instance from the backup tool (always test your backups).

Also, I would not favour a full rsync to a remote device - just does not suit my setup.

However, happy to accept your logic and decision :smiley:

Hello DietPi-ers,

Now I’m running two Synology’s as a NAS, one inside our Home, the other Synology is a daily backup at a fysical other location.
So basicly an 1 on 1 copy from Home.

I’m setting up DietPi on my Pine64 Rockpro64 which I want to use as my Home NAS incl. Nextcloud / Samba.
This DiePi will follow up my Home Synology.

How to create this daily backup from Home NAS running DietPi to this fysical other location with the Synology NAS.

I collect all the backups to one of the dietpis running at my home.
On the server I have created an NFS entry for each backup client

dietpi@RockPi:[~]$ cat /etc/exports
#/mnt/dietpi_userdata *(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)
/mnt/backup/odroid 10.0.2.2(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)

Then on each client I mount the NFS and tell dietpi-backup to store there:

dietpi@odroid:[~]$ cat /etc/fstab
10.0.2.5:/ /mnt/backup nfs _netdev,nofail,noauto,x-systemd.automount

dietpi@odroid:[~]$ cat /DietPi/dietpi/.dietpi-backup_settings
FP_TARGET=/mnt/backup/dietpi-backup

So basically if you can mount a remote drive with permissions compatible to linux, then you can take a remote backup.

yes indeed the backup location needs to be capable allow Linux permissions. You could using NFS on your Synology. On my test it was working well.

https://www.synology.com/en-global/knowledgebase/DSM/tutorial/File_Sharing/How_to_access_files_on_Synology_NAS_within_the_local_network_NFS

 DietPi-Backup
─────────────────────────────────────────────────────
 Mode: Backup

[  OK  ] DietPi-Backup | DietPi-Userdata validation: /mnt/dietpi_userdata
[ SUB1 ] DietPi-Services > stop
[  OK  ] DietPi-Services | stop : cron
[  OK  ] DietPi-Backup | Free space check: path=/mnt/nfs_client/data | available=2145406 MiB | required=3208 MiB
[ INFO ] DietPi-Backup | Backup to /mnt/nfs_client in progress, please wait...
sending incremental file list
    631,840,097  98%    1.36MB/s    0:07:23 (xfr#17866, to-chk=0/23106)

sent 633,288,016 bytes  received 371,441 bytes  1,412,841.60 bytes/sec
total size is 643,018,702  speedup is 1.01
[  OK  ] DietPi-Backup: Backup | Completed