RetroPie: Moving my games to an USB stick

on

I wrote this article on the RetroPie setup some time ago, but I’m still getting a lot questions and comments on this topic. I actually thought that with the last couple emulator station updates came some improvements to this process. As I have not touched my system for quite some time, I simply do not know. Also I got some comments on my old blog before it crashed, if symbolic links would be easier to use.

Using (thanks to a comment with no alias):

mv ~/Retropie/roms/ /mnt/roms/
ln -s /mnt/roms/ ~/Retropie/roms/

That might be the case, but in “the early days”, if I remember correctly, that did not work as the importing routine still started and messed up the files. This might be fixed now, so give it a try, but please do not blame me, if it does not work.

Here is the original article I wrote, manually changing the rom location.

Updated for RetroPie EmulationStation 2

As my RetroPie project progresses, I still struggle from time to time. One of these challenges was to move my games to a USB stick so I can save the space on my SD card.

If you want to move your games, there are a couple of points you have to keep in mind:

  • The USB stick has to be writable for the user “pi”
  • There is an auto import feature for game files on USB stick, which has to be avoided.
  • The paths for the new rom location has to  be adjusted
  • The path for your samba server has to be adjusted (if you use it)
  • The “gamelist.xml” has to be adjusted in each rom folder (if you have created them already)

Before we start I just want to mention that there are many ways to do this (and as I’m more or less a noob) – and surely much more advanced approaches. So if you see potential of improvements, please let me know in the comment section.

But let’s get started.

What you need on the hardware side in addition to your running Raspberry Pi with RetroPie is a USB stick (or something equivalent). I went for a USB stick with USB 3.0 support as they are supposed to be a little faster (even if they are used in USB 2 slots).

You have to connect via ssl to your RetroPie or drop out of Emulatorstation by pressing ALT-F4.

You can find out the folder that represents your USB stick by going to your media folder:

cd /media
ls

in my case it was the usb folder (depending on the number of usb storage devices it could also be also usb1, usb2,…)

Just plug it in and wait a moment – the RetroPie will now create a folder called roms with a folder structure inside representing all installed emulators. This is used for the auto import feature of the RetroPie. Any rom you copy in these folders will be copied to the SD card the next time you plug in the USB stick.

Make the USB stick writable for the user “pi”

RetroPie uses an automount feature – which is awesome, since the stick is automatically recognized and mounted to the system. In my case this came with a big flaw. All files and folders on the stick were read only for the RetroPie standard user. This prevents the RetroPie from adjusting the “gamelist.xml” in the rom folders.

The Emulatorstation and the games will still run, but nothing can be written on the usb stick.

So how to turn it of?

There are multiple approaches to this, like removing the automount feature, adding UDEV rules (telling the system how to deal with new identified devices), or changing the configuration of the automount program.

I went for the last alternative, as this worked best for me.

The automount program has a configuration file, which can be adjusted so all USB sticks in the future have writing permission for users or user groups. This is based on one of the answers given in this forum.

You have to edit the usbmount.conf file in /etc/usbmount/

sudo nano /etc/usbmount/

Then find a line:

FS_MOUNTOPTIONS=""

and change it to:

FS_MOUNTOPTIONS="-fstype=vfat,flush,gid=plugdev,dmask=0007,fmask=0117"

This applies the proper rights to all users in the plugdev group (which the standard user “pi” is a member of).

Now save via Ctrl-x and hit Y to overwrite the existing file.

retropie_2_001

 

retropie_2_002

To check if you are in this group you can enter:

group pi

Now the USB stick has the proper rights.

How to avoid the auto import feature

There is a very simple way to avoid the auto import feature. Just copy the content of the roms folder directly in the base folder of the USB stick.

cp -r /home/pi/Retropie/roms/* /media/usb/
  • cp is the command to copy files (and folders) in Linux
  • -r stands for recursively (so all subfolders are covered)
  • /home/pi/Retropie/roms/* is the standard folder for your roms on the RetroPie SD card
  • /media/usb/ this is the new location for your roms

Depending on the number and the size of your roms – this might take some time.

To check if everything works as planned just select the base directory of your usb stick and see if all directories are created.

cd /media/usb
ls

You should now have all rom folder including the roms on your USB stick.

retropie_2_003

How to adjust the paths to the new rom locations

The location of your roms is saved in the es_systems.cfg in the hidden folder .emulationstation/.

In Emulatorstation 2.0 the file has been moved to a new location (/etc/emulationstation/es_systems.cfg).

To change it, copy the file to your home drive in the .emulatorstation folder first:

cp /etc/emulationstation/es_systems.cfg ~/.emulationstation/es_systems.cfg

So edit this file enter:

nano /home/pi/.emulationstation/es_systems.cfg

Now change the path for each emulator from:

PATH=/home/pi/RetroPie/roms/

to

PATH=/media/usb/

Now save via Ctrl-x and hit Y to overwrite the existing file.

retropie_2_004

retropie_2_005

After a restart of Emulatorstation via

Alt-F4

and the command

emulatorstation

the roms from the USB stick should show up.

How to adjust the paths to the new rom locations

If you want to connect to your new rom folders from a different computer you have to adjust the Samba configuration, so it points to the right folders.

Open up and edit the smb.conf by typing:

sudo nano /etc/samba/smb.conf

There should be a part with the paths to the different rom folders which have to be changes to the new path on your USB stick (usually at the end of the file).

So exchange:

/home/pi/RetroPie/roms/

by:

/media/usb/

now save via Ctrl-x and hit Y to overwrite the existing file.

retropie_2_006

retropie_2_007

Changes to the “gamelist.xml” (if you use them)

To connect your roms to additional information (cover picture, game description, rating) you can use a file called gamelist.xml. This is usually automatically generated if you use the es_scraper script .

The easiest way to correct the gamelist files in all folders is to re-run the script – replacing the existing files using:

python scraper.py –f

This does not work for me, since I did not rely on the scraped information and created my own artwork.

I connected the USB stick to my PC and used a program called Notepad++ to replace the paths for:

  • The game roms
  • The game artwork

in all the gamelist files (one in each emulator folder).

By looking for

/home/pi/RetroPie/roms/

And exchanging it with:

/media/usb/

That’s it. All of your games should be on the USB-Stick now – and after restarting the Emulatorstation, all information should be displayed correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *