How to Backup Unraid


landS

Recommended Posts

5 minutes ago, superloopy1 said:

What i'm after is the exact rsync command which will allow me to sync a SHARE, not a disk, between two servers.

Here the rsync command I use for syncing shares.  This is an example of syncing my Movies share:

192.168.1.15 is the IP address of the backup server.  I am doing this via SSH so I have generated SSH keys that contain the password to the backup server and I am not prompted for the password as this (and all the other shares I back up) is automated in a script and runs once a week

rsync -avu --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  /mnt/user/Movies/ [email protected]:/mnt/user/Movies/  >> /boot/logs/cronlogs/BackupNAS_Movies.log

 

8 minutes ago, superloopy1 said:

Does rsync just copy many changes, allowing the time taken to sync to decrease after the initial sync up?

Yes, this command copies only new or modified files since the last backup.  I run another script about every 3-4 months to clean up files on the destination server that are no longer on the source server.  The command above deletes nothing on the backup server.

Link to comment
2 hours ago, Hoopster said:

Here the rsync command I use for syncing shares.  This is an example of syncing my Movies share:

192.168.1.15 is the IP address of the backup server.  I am doing this via SSH so I have generated SSH keys that contain the password to the backup server and I am not prompted for the password as this (and all the other shares I back up) is automated in a script and runs once a week


rsync -avu --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  /mnt/user/Movies/ [email protected]:/mnt/user/Movies/  >> /boot/logs/cronlogs/BackupNAS_Movies.log

 

Yes, this command copies only new or modified files since the last backup.  I run another script about every 3-4 months to clean up files on the destination server that are no longer on the source server.  The command above deletes nothing on the backup server.

Thanks for all of that but unfortunately generating SSH keys are way above my linux grade, are they needed and if not which 'bits' can i discard?

 

I'd be interested in any script you run as that is how i intend to backup once i've managed ito do the simple, basic initial share. This should be quite easy eh, but to all of us novices out here it's a bit scary. Good to know others are out there with the advice, thanks!

Link to comment
35 minutes ago, superloopy1 said:

I'd be interested in any script you run as that is how i intend to backup once i've managed ito do the simple, basic initial share.

The problem you will run into going from server to server is that without an SSH key generated with the appropriate root password for the destination server, the command will stop and prompt you to manually enter the password.  In an automated, set-it-and-forget-it scenario, you don't want to be prompted for a password as nothing will happen until it is entered.

 

https://superuser.com/questions/555799/how-to-setup-rsync-without-password-with-ssh-on-unix-linux

 

Once you have generated the SSH keys, you also will need to make some entries in the go file to preserve the keys across server reboots; otherwise when you reboot the server, they are gone and you will be prompted for the password again.

 

Something like this (medianas is my source server and backupnas is the destination):

 

# Copy SSH files back to /root/.ssh folder and set permissions for files
mkdir -p /root/.ssh
cp /boot/config/ssh/medianas_key /root/.ssh/id_rsa
cp /boot/config/ssh/known_hosts /root/.ssh/known_hosts
cat /boot/config/ssh/backupnas_key.pub > /root/.ssh/authorized_keys
chmod g-rwx,o-rwx -R /root/.ssh

 

Link to comment

Take this with a grain of salt since i dont use Rsync myself but i would be tempted not muck around in unraid's ssh config to get this done. Rather i would be tempted to setup a docker container with sshd, and pass the destination share/folder as a volume mount. I would guess that there is a docker container out there that can generate and persist the ssh keys automatically, maybe saving them to an external volume that can be bound to the app data folder.

Link to comment
3 hours ago, superloopy1 said:

Thanks to both of you but I'm now in a quandry since I know of no such docket container and if I did wouldn't have the nous to set it up. I'd only just managed to understand H's contribution.

Just a suggestion. If ever think of pursuing it further A quick docker hub search brought up this container https://github.com/panubo/docker-sshd https://hub.docker.com/r/panubo/sshd/

Link to comment
1 minute ago, superloopy1 said:

No idea where to start

The gory details can be found here.  It can seem daunting at first so, I would do a quick read through the thread. 

 

I am no scripting or SSH genius; fortunately, there were some very helpful responses in that thread.  I'll PM you the script I am using to backup several shares from one server to another. The script is automated through the User Scripts plugin and runs once a week.  It has been running for almost two years with ZERO issues.

 

Since my backup server has IPMI, the script also powers on the server before backup and powers it down until needed the next week.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.