Backing up USB drive on ROCK to NAS

I am keeping my music on an USB drive attached to a NUC running ROCK.
Now I would like to backup this USB drive to a Synology NAS. On the NAS I have only found settings to backup the NAS to a network location, but not the other way around.
How do I best do this, preferably using rsync, so I have the exact identical directory structure on the USB disk and on the NAS (If the USB disk should fail, I would like to be able to simply point ROCK to the NAS).

Mount the storage from ROCK on your Synology.
https://www.synology.com/en-uk/knowledgebase/DSM/help/FileStation/mountremotevolume
I don’t know if Synology has software to back up from here as I have QNAP ansni can back up from remote smb filesystems using it hybrid backup sync.

User and password to use is guest

Thanks, Simon
That seems to work fine. The thing I’m struggling with is how to get rsync configured on the Synology.

Sorry im no rsync expert at all. I always have to ask my works tech support on how do it in cmdline. How you’d automate it I have no idea.

Hi! I’m using rsync to back up my data from the Syno. Rsync is included on the syno, so I’ve put together a howto here that doesn’t involve the use of any terminal tinkering (though that can be fun too).

Having mounted the rock data folder on your syno, it will have a path similar to this (depending on where you mounted it): /volume1/Utilities/roondata/

What you’ll want to do now is create a shell script that backs up the music from one of the subfolders in that folder (/volume1/Utilities/roondata/Storage/usbdrivename)

The shell script can simply be a plain text file that you store somewhere. E.g. usbbackup.sh that contains the following single command:

rsync -av --delete --size-only /volume1/Utilities/roonstorage/Storage/usbdrivename [destination share and folder]

Explanation of flags:
av : a and v flags enable Archive (which also includes subfolders so you won’t have to worry about specifying the recursive flag) and Verbose mode, in case you want to verify what the operation does in the logs

delete means that files not present in the source will be deleted in the destination. This way, only content that is currently in the source will remain in the destination after syncing. Deletes in the source are repeated in the destination. Helps keep files in complete sync.

size-only means that the sync is less exhaustive - it checks the source and destination file size, and if they’re a match, no copy is done. This allows for a quicker sync than the normal file compare mode that rsync uses.

Finally, to schedule the task, you can use the Task scheduler in the control panel. Schedule a task that runs on particular days, for example. The screenshot below shows my setup:

You can see the command starts with bash - that’s the command to invoke the synology linux shell, followed by the path to the shellscript (.sh file)

If you don’t want to schedule the task but rather run it on particular times, just set a schedule, and then after saving remove the tick box in the list of tasks. That will effectively disable the scheduling, and you can manually select the operation and choose Run at your own discretion.

As you can see from the example screenshot, I use this to back up music on my syno to an external USB drive that I connect to the nas every now and then, but the principle is just the same.

4 Likes

No relevance to me but a great reply! Brilliant.

1 Like

Thx - we aim to please. All those years doing software documentation pay off - the appreciation level on this forum is amazing :smiley:

1 Like

I’m not sure that you could get a more niche group of people on this forum. People who have a music collection, are interested in the guts of it, willing to pay for what most would expect for free etc etc. Maybe that means we are all generous and open minded. (Or we are all such tinkerers we recognise that WE are going to be the next one asking for help :grinning:)

@oafrenning
I can only say WOW! Thanks a million, your explanation is simply stunning. If only Synology would take as much care in describing their stuff. Its really fora and users like this / you that come to the rescue when business logic is leaving us out in the cold.
THANK YOU!
This should definitely go into the Roon Knowledge base. After all this use case is what Roon describes as preferred. Music on USB drive attached to Roon Core, backup to NAS

1 Like

No sweat, it’s feedback like this that makes my day a little brighter. Now, of only someone would send a heads-up to the roon chaps, perhaps this could find its way into the roon kb :slight_smile:

I’ll be monitoring the feed just in case you encounter any issues setting it up :slight_smile:

@oafrenning
Does this look about right? No quotes needed like in Windows?
rsync -av --delete --size-only /volume1/RF/Roon_Music_USB/1a MP3 /volume1/music/1a MP3

When you get to the part that says 1a MP3, linux won’t approve of the space in the path, so you need to escape it, like so: 1a\ MP3

It looks weird, but that’s how linux formats spaces. Other than that, fire away

Oh, and you may have to omit specifying the final folder level in the destination as rsync may create it. Test with a non dangerous destination folder first to see how the structure pans out

It looks like its working:

Task Scheduler has completed a scheduled task.
Task: Backup USB Roon Core
Start time: Thu, 29 Nov 2018 16:36:31 GMT
Stop time: Thu, 29 Nov 2018 16:41:51 GMT
Current status: 0 (Normal)

Thanks again.

After the euphoria of success, the following got me thinking, and I am curious about everyone’s thoughts.

Up to now I thought that the USB disk attached to Roon Core should be the master and should be backed up to the NAS daily using rsync. Now what if for some reason, the data on the USB disk gets deleted and the rsync task then dutifully brings the NAS backup to the same state at the next run (i.e. empty). Major disaster.

Would it be better to declare the NAS music folder the master and rsync out to the USB disk attached to Roon Core daily? A NAS has a more graceful way of failing (if the disks are set up to be redundant) and such a major disaster would be less likely. The data on the NAS would then be backed up to a third location for safety.

The same rsync routine could still be used, just with different source and target paths.

2 Likes

That is the way I do it.

When I get new music I copy it to the NAS, then run the sync to the USB drive. When the sync in done, I open up roon and enjoy the music. Really only takes a minute or two when adding just a couple of downloads.

I dont use the delete option. For me it is not necessary since I am the only one adding music to the NAS. the music on the USB drive is never touched except by Roon. If I need to do some cleanup, I can always run the cmdline with the delete.

1 Like

Thanks @Rugby
Sounds sound. Using the NAS as master also does away with the question of exfat formatting for the USB HD (to copy music to it from a Windows PC). It can be formatted ext4, as it is only accessed by ROCK.

1 Like

Looks like someone beat me to it. Sounds like you’ve got this one figured out :smiley:
Happy tinkering!

Glad I came across this thread.
Wanted to set up a USB attached to ROCK and use rsync to update with music from syno NAS.

Found the instructions on the syno web site to be a head scratcher.

The info in this thread by @ged_hickman1 @jacobacci and @oafrenning had the ROCK attached USB drive mounted in DSM and rsync doing its thing in less than 10 minutes.

Very impressed.

Cheers
:v: :love_you_gesture: