This process will allow you to sync files between multiple Shields running RetroArch using a Synology NAS (DS416j).
This is my current setup that I have been running for 6 months now and I have no issues with starting in one room and finishing a game in another. There are some caveats
Concept
The NAS will mount each Shield’s RetroArch directory and then rsync
is used to sync each Shields selected folder to a centralized folder.
The ROMS are not synced as these could be larger than the capacity of the drive in the Shield. Instead, we configure the Shield to pull the ROMS from the NAS.
When configuring the syncing, only sync the folders that are worth sharing. Do not attempt to do the entire RetroArch directory, I have not had success with this and it seems to break often.
When you select a folder to sync, realize there will be 2 commands per folder per Shield.
One to copy the files to the NAS, the other to copy from the NAS to the Shield.
Current Shields:
IP | Shield | Mount Source | Mount Destination |
---|---|---|---|
10.1.1.145 | Office | \\10.1.1.145\internal\RetroArch | /volume1/Emulation/retroarch/ShieldTVs/Office |
10.1.1.146 | MainBdr | \\10.1.1.146\internal\RetroArch | /volume1/Emulation/retroarch/ShieldTVs/MainBdr |
10.1.1.147 | Lvr | \\10.1.1.147\internal\RetroArch | /volume1/Emulation/retroarch/ShieldTVs/Lvr |
Prepare the Shield
First, you will need to enable local network file transfer.
Open up Settings and go to Device Preferences. Select Storage and turn on Transfer files over local network. You will need the IP, username and the password to mount this to the NAS.
Prepare the NAS
To prepare the NAS, you need to create a new shared folder that you want to store the shared data.
Open File Station and click on Create and select Create New Shared Folder.
Name this folder: Emulation
or whatever you want.
Put all your ROMS and whatever other files you want here for emulation. This is the folder that will hold all your emulation data.
Inside Emulation
, create a folder that we will mount the Shields to; I named mine retroarch
.
Inside this directory (retroarch
) create the folders you want to sync.
The folders I chose to sync are:
playlists
saves
states
These folders need to be created before you can use rsync
on them.
Next, you want to prepare the folders to mount the Shields to.
Inside the same folder (retroarch
), create a new folder called: ShieldTVs
or whatever you want.
Inside ShieldTVs
, create a folder for each Shield you want to have mounted. I typically name them where they are located.
For now, let’s just say I have 3 Shields I want to mount, I would create 3 new folders so my ShieldTVs
directory would have these 3 folders:
Office
MainBdr
Lvr
Now that everything is prepared, you can configure the mounts.
Configure mounts on the NAS
Open File Station and click on Tools, go to Mount Remote Folder and select CIFS Shared Folder.
For this example, I am using 10.1.1.145
as the IP address of the Shield I am mounting. You will want to do this step for every Shield you plan to have synced.
When configuring the share:
- Folder:
\\10.1.1.145\internal\RetroArch
- This is the remote mount location and what folder you want to have mounts, we want
RetroArch
.
- This is the remote mount location and what folder you want to have mounts, we want
- Account name:
username
- This is the username that you copied from the Shield in the Prepare the Shield step.
- Password:
password
- This is the password that you copied from the Shield in the Prepare the Shield step.
- Mount to:
/Emulation/retroarch/ShieldTVs/Office
- This is the local path on the NAS that you want to mount the Shield to.
- Make sure the check the checkbox for Mount automatically on startup
Once this is done for every Shield, then you can configure the NAS to sync the files.
Configuring rsync on the NAS
There are two ways to do this:
- Use the Task Scheduler on the NAS
- SSH into the NAS and configure cron
Use the Task Scheduler on the NAS
Instead of having to SSH, you can use Scheduled Tasks.
Open Control Panel and click on Task Scheduler. NOTE: you may need to click on Advanced Mode to see this.
Once in the Task Scheduler, click Create and hover over Scheduled Task and select User-defined script.
This should bring up the Create Task window.
Name the task whatever you want, I named mine: RetroArch Syncing - Office
. Note, that I am creating a task for each Shield I am setting up. This is better as if there is an issue with a specific Shield, this will only affect that single Shield. Plus, if you turned on notifications, then this will be easier for debugging.
For the User, you will want to use the current user are have configured everything with; For me, it’s admin
.
Make sure it’s enabled then select the Schedule tab.
Configure Date to run Daily; for Time, select Every 5 minutes.
Set the First run time to be the same hour as it is currently.
For Last run time set that to be 23:55
for it to work right.
Next, click on the Task Settings tab.
You can configure notifications if you want but I don’t recommend it.
For the run command, to match what I have for the SSH example, this is what I used in the User-defined script:
This is the command for the Office syncing:
/bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/saves/* /volume1/Emulation/retroarch/saves /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/states/* /volume1/Emulation/retroarch/states /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/playlists/* /volume1/Emulation/retroarch/playlists /bin/rsync -auz /volume1/Emulation/retroarch/saves/* /volume1/Emulation/retroarch/ShieldTVs/Office/saves /bin/rsync -auz /volume1/Emulation/retroarch/states/* /volume1/Emulation/retroarch/ShieldTVs/Office/states /bin/rsync -auz /volume1/Emulation/retroarch/playlists/* /volume1/Emulation/retroarch/ShieldTVs/Office/playlists
Or, you could also just have a single task and put the Shields commnd in this, I do not like this approach but it works just as well. This would look like:
# Office /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/saves/* /volume1/Emulation/retroarch/saves /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/states/* /volume1/Emulation/retroarch/states /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/playlists/* /volume1/Emulation/retroarch/playlists /bin/rsync -auz /volume1/Emulation/retroarch/saves/* /volume1/Emulation/retroarch/ShieldTVs/Office/saves /bin/rsync -auz /volume1/Emulation/retroarch/states/* /volume1/Emulation/retroarch/ShieldTVs/Office/states /bin/rsync -auz /volume1/Emulation/retroarch/playlists/* /volume1/Emulation/retroarch/ShieldTVs/Office/playlists # MainBdr /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/MainBdr/saves/* /volume1/Emulation/retroarch/saves /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/MainBdr/states/* /volume1/Emulation/retroarch/states /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/MainBdr/playlists/* /volume1/Emulation/retroarch/playlists /bin/rsync -auz /volume1/Emulation/retroarch/saves/* /volume1/Emulation/retroarch/ShieldTVs/MainBdr/saves /bin/rsync -auz /volume1/Emulation/retroarch/states/* /volume1/Emulation/retroarch/ShieldTVs/MainBdr/states /bin/rsync -auz /volume1/Emulation/retroarch/playlists/* /volume1/Emulation/retroarch/ShieldTVs/MainBdr/playlists # LVR /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Lvr/saves/* /volume1/Emulation/retroarch/saves /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Lvr/states/* /volume1/Emulation/retroarch/states /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Lvr/playlists/* /volume1/Emulation/retroarch/playlists /bin/rsync -auz /volume1/Emulation/retroarch/saves/* /volume1/Emulation/retroarch/ShieldTVs/Lvr/saves /bin/rsync -auz /volume1/Emulation/retroarch/states/* /volume1/Emulation/retroarch/ShieldTVs/Lvr/states /bin/rsync -auz /volume1/Emulation/retroarch/playlists/* /volume1/Emulation/retroarch/ShieldTVs/Lvr/playlists
SSH into the NAS and configure cron
I am not sure if you need to do anything to enable SSH for your NAS. If I did, it did it a while ago and do not remember how I did it. That should be easy enough to search online if you need to.
You will need to SSH to your NAS for this step to work. Also, you will need sudo
access so make sure the account is an administrator.
I will use 10.1.1.10
as my IP for the NAS.
Connect to your NAS:
ssh username@10.1.1.10
Enter your username password on the password prompt, this is the same login as the NAS.
Open crontab:
sudo vi /etc/crontab
Then paste this in (one entry for each folder and each Shield to sync)
# Office */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/saves/* /volume1/Emulation/retroarch/saves */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/states/* /volume1/Emulation/retroarch/states */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Office/playlists/* /volume1/Emulation/retroarch/playlists */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/saves/* /volume1/Emulation/retroarch/ShieldTVs/Office/saves */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/states/* /volume1/Emulation/retroarch/ShieldTVs/Office/states */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/playlists/* /volume1/Emulation/retroarch/ShieldTVs/Office/playlists # MainBdr */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/MainBdr/saves/* /volume1/Emulation/retroarch/saves */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/MainBdr/states/* /volume1/Emulation/retroarch/states */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/MainBdr/playlists/* /volume1/Emulation/retroarch/playlists */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/saves/* /volume1/Emulation/retroarch/ShieldTVs/MainBdr/saves */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/states/* /volume1/Emulation/retroarch/ShieldTVs/MainBdr/states */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/playlists/* /volume1/Emulation/retroarch/ShieldTVs/MainBdr/playlists # LVR */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Lvr/saves/* /volume1/Emulation/retroarch/saves */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Lvr/states/* /volume1/Emulation/retroarch/states */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/ShieldTVs/Lvr/playlists/* /volume1/Emulation/retroarch/playlists */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/saves/* /volume1/Emulation/retroarch/ShieldTVs/Lvr/saves */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/states/* /volume1/Emulation/retroarch/ShieldTVs/Lvr/states */5 * * * * root /bin/rsync -auz /volume1/Emulation/retroarch/playlists/* /volume1/Emulation/retroarch/ShieldTVs/Lvr/playlists
Then restart cron:
sudo synoservice -restart crond
Happy Gaming
If you followed this properly, you should now be setup with syncing across your Shields for RetroArch.