Unraid NAS - auto backup share to external USB

Soldato
Joined
16 Jul 2004
Posts
4,461
Location
Home
As title, how do I do this?
I currently am running rsync which I manually types in to move a photo folder from the array to the external USB drive (it's taking a long time...).

But anyway, I used to use Synology which when you plugged in the drive and hit backup, it would run a process to backup the share which was speedy as only updated the backup drive with files that had changed.

I have read from the unraid forums that using a script in unassigned devices would do this, but in all honesty I am bamboozled by the task.
There is a sample script on the Unraid forum
but my questions begin with:

Where do I create and save the script?
What parts of the script do I need to edit?
How do I tell unassigned devices plugin to run the script?

Does anyone have an idiot proof starter guide on doing this?
 
I've not done it automatically but I would think the script could be stored anywhere that makes sense in the filesystem. I've seen people suggest /boot/scripts which I think is the flash drive. Then my guess is that you make reference to that in the settings of the unassigned device as there's an option to point to a 'device script' and to run it in the background.
 
The magic button you had on your Synology was just a pretty front end for doing more or less what the Unraid link you've posted will do.

It s just a case of putting an rsync line into the scripts and then setting it when to run. I do similar with my main share to my backups although that's an alternate network share and but using unassigned devices woudl put it into /mnt/disks I think which should be just as easy.
 
Thanks guys - I think I'm just not totally clear on script creation and execution and there's lots of parts of that sample script that I don't understand, like all references to $ terms, am I meant to fill in the details that are unique to my setup?
What is the first line even about ?!
#!/bin/bash
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin

so many bins

I assume I would create the script in nano and save it as a sh file? Would I need to make it executable or not?

Sorry - I have done some scripting before but this just scares me more for some reason, as much as I want to give it a go!


Granted I don't NEED to use this script - as I said, I have used the rsync command in a terminal window in the unraid webgui to test backing up a single folder successfully.

But, from my experience with other Linux commands via SSH, they have terminated when the ssh connection closes. Therefore I feel like if I ran rsync from a terminal window, I would need to leave the window open until the command completes, which would be HOURS for the first backup... Or am I wrong with this?
 
Thanks guys - I think I'm just not totally clear on script creation and execution and there's lots of parts of that sample script that I don't understand, like all references to $ terms, am I meant to fill in the details that are unique to my setup?
What is the first line even about ?!
#!/bin/bash
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin

so many bins

I assume I would create the script in nano and save it as a sh file? Would I need to make it executable or not?

Sorry - I have done some scripting before but this just scares me more for some reason, as much as I want to give it a go!


Granted I don't NEED to use this script - as I said, I have used the rsync command in a terminal window in the unraid webgui to test backing up a single folder successfully.

But, from my experience with other Linux commands via SSH, they have terminated when the ssh connection closes. Therefore I feel like if I ran rsync from a terminal window, I would need to leave the window open until the command completes, which would be HOURS for the first backup... Or am I wrong with this?

Have a look at the user scripts plugin.
You can then easily edit and schedule scripts from you Unraid settings tab and have the option to run the script live, run in the background or run on a schedule.

A lot of shared scripts are complicated and have all sorts of error checking etc. which makes them more difficult to understand.

At a base level you need little more than your rync command in a 'script' which User Scripts makes super easy
 
Back
Top Bottom