How To Use 'rsync' To Sync Saves Between The Anbernic RG351MP And Anbernic RG351V

I finally figured out how to use ‘rsync’ so that I can sync battery saves between two handheld retro handheld devices I bought last year, which include the ‘Anbernic RG351MP’ and ‘Anbernic RG351V’:

‘rsync’ is basically a program that allows you to sync files between two Linux machines. You can use it for backing up files, entire harddrives, websites, you name it.

The cool application that I am going to explore in this blog post is how to make ‘rsync’ work for you so that you can seamlessly backup saves between your devices.

NOTE:

What you will need to have the following:

With this in mind, let’s get started.

First, install ‘rsync’ on the central Linux server you plan on using.

In my case, I have an old Dell Optiplex that’s running ‘Fedora Server’ on my local LAN network.

I simply used this command to install ‘rsync’, but you might need to modify this command depending on what Linux distro you’re using:

sudo dnf install rsync

The next step is to pick a file path location on your Linux server where you want to dump your emulator saves to. In my case, I have a harddrive automatically mounted to ‘/media/REDHDD’ via a cronjob that starts when my Linux server boots up. As a result, I used the ‘/media/REDHDD/EmulatorsFolder/saves’ directory. Keep this in mind for the ‘rsync’ commands later in the blog post.

After that, you will then need to be able to ‘ssh’ into each of the handheld devices. Here is the default ‘ssh’ command with its associated password for the default ‘ssh’ user on the ‘Anbernic RG351MP’ and ‘Anbernic RG351V’ devices. If you have BOTH the ‘Anbernic RG351V’ and ‘Anbernic RG351MP’, please open up two separate terminal windows to do the following commands in tandem:

NOTE: Any time you see a ‘#’ sign, this is just a comment within the script below telling you what to enter

Anbernic RG351MP version of the ‘ssh’ command:

ssh root@rg351mp

# NOTE: Once it prompts you for a password, enter in the following password as the following without the hashtag:
# 351elec
# Then, press the 'Enter' key on your keyboard

Anbernic RG351V version of the ‘ssh’ command:

ssh root@rg351v

# NOTE: Once it prompts you for a password, enter in the following password as the following without the hashtag:
# 351elec
# Then, press the 'Enter' key on your keyboard

Now that we are connected into the retro handheld via ‘ssh’, you’ll want to do the following command to make a ‘saves’ directory on the SD card (NOTE: If you have BOTH Anbernic devices, repeat this command in each separate terminal window):

mkdir saves

Great, we now created a dedicated ‘saves’ folder on the SD card. On a separate note, we will later refer to this file path as ‘/storage/saves’ since 351Elec mounts an SD card in the ‘/storage’ mountpoint by default, and also due to the fact that we created this directory in the ‘root’ of the SD card. Hence, ‘/storage’ (root of the SD card) + ‘saves’ (directory we just created) –> ‘/storage/saves’.

Now, let’s change our focus to ‘Retroarch’ on the retro handheld devices themselves by doing the following steps:

Now for the testing portion of this blog post:

Pick a retro game where you know the game itself would have saved onto the cartridge in real life. Ex: A save point in some Final Fantasy RPG, or Chrono Trigger, is a perfect example of this since when you save the game, it would have saved to the actual cartridge’s memory in real life. In the case of emulators like this, when you save your progress while playing a ROM in an emulator like this, RetroArch will create a corresponding ‘.srm’ save file in the folder we chose above, aka ‘/storage/saves’. On a related note, the ‘.srm’ file will have the same name of the corresponding ROM itself, just with the ‘.srm’ file extension, so they are super easy to spot in a file manager application.

In my case, I used ‘Super Mario World’, and deliberately beat a previous ‘Ghost House’ level in a different section of the map to force the game to prompt me to ‘Save and Continue’.

Now that we know we have saved our game accordingly, we want to sync our latest battery save to our central file server accordingly.

Here are the related ‘rsync’ commands you’ll need to sync up your save to your file server, so note, PLEASE pay attention to what you’re doing since I don’t want you to lose progress on your games.

Here are the ‘rsync’ commands to sync your game save up to the central file server:

GENERAL RSYNC NOTE:

NOTE:

From The RG351MP To File Server:

rsync -av root@rg351mp:/storage/saves /media/REDHDD/EmulatorsFolder

From RG351V To File Server:

rsync -av root@rg351v:/storage/saves /media/REDHDD/EmulatorsFolder

Then, to sync them from the file server to the other handheld, you can then use these commands accordingly:

NOTE: Please adjust the first portion of the command, ‘/media/REDHDD/EmulatorsFolder’ accordingly to whatever file path you want to place them onto your file server, since this is just what I personally do for my saves:

From File Server To RG351MP:

rsync -av /media/REDHDD/EmulatorsFolder/saves root@rg351mp:/storage

From File Server To RG351V:

rsync -av /media/REDHDD/EmulatorsFolder/saves root@rg351v:/storage

And that’s it!

It took a while for me to figure out, but honestly, this is going to be awesome, especially if I utilize some Bash aliases accordingly in my ‘~/.bashrc’ config accordingly.

Here’s an example of how to use Bash aliases in this case to make your life easier

I could create a ‘mpup’ Bash alias to run the first command on the ‘RG351MP’ to sync UP to the file server:

alias mpup="rsync -av root@rg351mp:/storage/saves /media/REDHDD/EmulatorsFolder"

I could also create a “vup” Bash alias to run the first command on the ‘RG351V’ to sync UP to the file server:

alias vup="rsync -av root@rg351v:/storage/saves /media/REDHDD/EmulatorsFolder"

I could then make the reverse ‘vdown’ Bash alias to bring the latest saves from the file server DOWN to the ‘RG351V’

alias vdown="rsync -av /media/REDHDD/EmulatorsFolder/saves root@rg351v:/storage"

I could also then make the reverse ‘mpdown’ Bash alias to bring the latest saves from the file server DOWN to the ‘RG351MP’

alias mpdown="rsync -av /media/REDHDD/EmulatorsFolder/saves root@rg351mp:/storage"

You would then just need to place these commands into your ‘~/.bashrc’ config, and you would be good to go!

You can find these Bash alias commands above, as well as any other related alises I’ve used here, so feel free to steal them to use them in your own dotfiles on your machine:

Hope this helps someone out who has Anbernic retro handheld devices like me!

~ Sam