February 19, 201610 yr Hello all, have searched g/com and forum, and does not appear to be a good solution to the below problem. I have an unRAID box I am beginning to use again after a massive failure (likely my fault from clicking away). I have the system backing up as a whole to crashplan, so i am covered for an online copy. However, I want to automate critical folder backups to 2TB USB drives, which can be alternated and then stored in a fireproof safe/off-site. I have looked into several options, but can not figure out how to get BTSync to sync folders locally to a local usb. Crashplan stores a database file and I want the raw data available as a backup. The plugin "Unassigned Devices" seems like a good option to get the drive mounted and accessible, however I am at a loss to find a docker solution to complete this task. I realize I could use VM options, but that seems more cumbersome to install/maintain. Any advice on where to look, or your personal setups would be helpful. P.S. I realize that a 2nd unraid server would be beneficial, however I only have one location available right now, and having 2 servers does prevent from HW failure, but does nothing for fire or theft... Thanks again for your help. -D
February 19, 201610 yr Community Expert I backup 2 shares to NTFS disks to store offsite similar to your requirements. I just use Unassigned Devices with an rsync script. Unassigned Devices has the ability to automatically run a script when a drive is mounted. Not exactly a completely GUI solution but there is an example script like this in the first post of Unassigned Devices thread.
February 19, 201610 yr Author Any chance you can post a sample of your script and where you save it? Think its the script button on the main page for each device? How do i configure the script for specific shares/drives?
February 19, 201610 yr Community Expert As mentioned, the first script here is a good start. I have been using this somewhat more complicated script since unRAID v4.7
February 19, 201610 yr Author Yes i found the first one, have been playing with it and 2 flash drives to test... Am I able to just add additional rsync lines to the script for multiple folders? #!/bin/bash PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin ## Available variables: # AVAIL : available space # USED : used space # SIZE : partition size # SERIAL : disk serial number # ACTION : if mounting, ADD; if unmounting, REMOVE # MOUNTPOINT : where the partition is mounted # FSTYPE : partition filesystem # LABEL : partition label # DEVICE : partition device, e.g /dev/sda1 # OWNER : "udev" if executed by UDEV, otherwise "user" # PROG_NAME : program name of this script # LOGFILE : log file for this script case $ACTION in 'ADD' ) # # Beep that the device is plugged in. # beep -l 200 -f 600 -n -l 200 -f 800 sleep 2 if [ -d $MOUNTPOINT ] then if [ $OWNER = "udev" ] then beep -l 100 -f 2000 -n -l 150 -f 3000 beep -l 100 -f 2000 -n -l 150 -f 3000 logger Started -t$PROG_NAME echo "Started: `date`" > $LOGFILE logger Pictures share -t$PROG_NAME rsync -a -v --delete /mnt/user/SCANS $MOUNTPOINT/ 2>&1 >> $LOGFILE ###I ADDED THE LINE BELOW### rsync -a -v --delete /mnt/user/appdata $MOUNTPOINT/ 2>&1 >> $LOGFILE ### ### logger Syncing -t$PROG_NAME sync beep -l 100 -f 2000 -n -l 150 -f 3000 beep -l 100 -f 2000 -n -l 150 -f 3000 beep -r 5 -l 100 -f 2000 logger Unmounting PicturesBackup -t$PROG_NAME /usr/local/sbin/rc.unassigned umount $DEVICE echo "Completed: `date`" >> $LOGFILE logger Pictures Backup drive can be removed -t$PROG_NAME /usr/local/emhttp/webGui/scripts/notify -e "unRAID Server Notice" -s "Server Backup" -d "Pictures Backup completed" -i "normal" fi else logger Pictures Backup Drive Not Mounted -t$PROG_NAME fi ;; 'REMOVE' ) # # Beep that the device is unmounted. # beep -l 200 -f 800 -n -l 200 -f 600 ;; esac
February 19, 201610 yr Community Expert ...Am I able to just add additional rsync lines to the script for multiple folders? Yes
February 19, 201610 yr Author Ok thank you. And looking at the modifiers rsync -a -v --delete --delete will go through the backup drive and delete the files I have deleted from unraid? -a is archive mode where it will keep the original file properties (modified date, etc)? -v verbose... im assuming this makes the beeping and notification functions work? *the last question has to do within the script button of unraid - there is a slider called "Run in background"... what does this do in the practical sense to the script?
February 19, 201610 yr Community Expert --verbose controls how much information is included in the log. Run in background basically makes things not wait for the script to complete. In this particular case it will have the effect of enabling the Unmount button while the script is still running.
February 19, 201610 yr Author awesome thank you! Seems to be working. Going to clear off a drive and give it a try now on the main rig. Thanks again -D
Archived
This topic is now archived and is closed to further replies.