Backup and Restore to network?

Suggestions for features and software you would like to see in DietPi, goes here.
Post Reply
Databeredning
Posts: 2
Joined: Sat Dec 15, 2018 3:01 pm

Backup and Restore to network?

Post by Databeredning »

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?
User avatar
MichaIng
Site Admin
Posts: 3268
Joined: Sat Nov 18, 2017 6:21 pm

Re: Backup and Restore to network?

Post by MichaIng »

@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
baz123
Posts: 172
Joined: Thu Jan 12, 2017 9:23 pm

Re: Backup and Restore to network?

Post by baz123 »

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?
User avatar
MichaIng
Site Admin
Posts: 3268
Joined: Sat Nov 18, 2017 6:21 pm

Re: Backup and Restore to network?

Post by MichaIng »

baz123 wrote: Tue Jan 22, 2019 11:49 am Could the backup create a compressed archive
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
baz123 wrote: Tue Jan 22, 2019 11:49 am to an off device location (samba share, rsync, USB device, cloud file storage)?
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.
baz123 wrote: Tue Jan 22, 2019 11:49 am Could there be a schedule function for backup as well so backups are taken at a regular interval/specific time?
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.
baz123
Posts: 172
Joined: Thu Jan 12, 2017 9:23 pm

Re: Backup and Restore to network?

Post by baz123 »

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 :D
hemertje
Posts: 23
Joined: Mon Dec 21, 2020 11:35 am

Re: Backup and Restore to network?

Post by hemertje »

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.
User avatar
trendy
Posts: 362
Joined: Tue Feb 25, 2020 2:54 pm

Re: Backup and Restore to network?

Post by trendy »

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

Code: Select all

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:

Code: Select all

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.

Image
User avatar
Joulinar
Posts: 5702
Joined: Sat Nov 16, 2019 12:49 am

Re: Backup and Restore to network?

Post by Joulinar »

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/know ... etwork_NFS

Code: Select all

 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
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply