Sync EmuDeck Saves with Rclone on SteamDeck

What is EmuDeck?

EmuDeck is a collection of scripts that allows you to autoconfigure your Steam Deck, it creates your roms directory structure and downloads all of the needed Emulators for you along with the best configurations for each of them. -https://github.com/dragoonDorise/EmuDeck

What is Rclone?

Rclone is a command-line program to manage files on cloud storage. It is a feature-rich alternative to cloud vendors' web storage interfaces. -https://rclone.org/

Things You Will Need

Before You Begin

Make a manual backup of your save files just in case something goes wrong during the initial setup of Rclone.

Install and Configure Rclone

  1. Boot the SteamDeck > Long press the power button > Shutdown > Switch to Desktop
  2. Click the Application menu > Search Konsole > Select Konsole to launch a terminal
  3. Continue with the following commands in Konsole
    # set a password if you haven't already
    # enter and confirm a password
    passwd
    # if emudeck was installed on microSD, run the following to create a symlink in the home directory
    # if you're not sure, navigate to the path in Dolphin, right click and Open Terminal, then run pwd
    mkdir ~/Emulation
    ln -s /run/media/mmcblk0p1/Emulation/saves ~/Emulation/
    # make steamos writable
    sudo steamos-readonly disable
    # install rclone
    sudo -v ; curl https://rclone.org/install.sh | sudo bash
    # make steamos readonly
    sudo steamos-readonly enable
    # verify rclone installed
    rclone version
    # configure rclone
    rclone config
    # setup a new rclone remote storage location
    n
    # enter a name for the remote storage location
    EmuDeckSaves
    # select the type of storage
    # here you can select the storage type to use
    # SMB/CIFS in this example
    smb

    # follow the prompts to configure the remote storage
    # this will vary depending on the storage type selected
    # the steps below are for smb

    # enter the smb host
    i12bretroDC
    # enter the smb username to use
    i12bretro
    # enter the smb port or press enter to use the default
    <%enter%>
    # choose a password option
    y
    # enter and confirm the smb password to use
    <%smb password%>
    # enter an optional auth domain
    i12bretro.local
    # enter advanced config
    n
    # review the summary and confirm
    y
    # quit rclone config
    q
    # test the configuration
    # if any errors are shown, troubleshoot before moving on
    rclone test memory EmuDeckSaves:/EmuDeck/Saves
    # if using a subdirectory, add it after the remote storage name
    rclone test memory EmuDeckSaves:/EmuDeck/Saves
    # run an initial sync
    # once the sync completes, verify the contents of the SMB share
    rclone bisync --resync --copy-links ~/Emulation/saves EmuDeckSaves:/EmuDeck/Saves

Scheduling Automatic Sync

  1. Continue with the following steps in terminal
    # create a systemd user config directory
    mkdir ~/.config/systemd/user -p
    # create and edit a systemd timer
    nano ~/.config/systemd/user/sync-emudeck-saves.timer
  2. Paste the following into the .timer, adjust the OnCalendar value to change from every 15 minutes

    [Unit]
    Description=Scheduled EmuDeck saves Rclone sync timer

    [Timer]
    OnCalendar=*:0/15
    Persistent=true

    [Install]
    WantedBy=timers.target

  3. Press CTRL+O, Enter, CTRL+X to save the changes and exit
  4. Continue with the following steps in terminal
    # create and edit a systemd service
    nano ~/.config/systemd/user/sync-emudeck-saves.service
  5. Paste the following into the .service, updating the two paths in the rclone command to match the source and destionation as needed

    [Unit]
    Description=Scheduled EmuDeck saves Rclone sync service

    [Service]
    ExecStart=/usr/bin/rclone bisync --copy-links /home/deck/Emulation/saves EmuDeckSaves:/EmuDeck/Saves

  6. Press CTRL+O, Enter, CTRL+X to save the changes and exit
  7. Continue with the following steps in terminal
    # start and enable the systemd timer
    systemctl enable sync-emudeck-saves.timer --now --user
    # list the systemd timers
    systemctl list-timers --all --user
  8. Create some test files in both the SMB share and ~/Emulation/saves and verify the two way sync is working as expected

Special thanks to jcnix for the idea https://github.com/jcnix/emudeck-saves-sync