Run ROMs from USB flash drive instead of microSD card - manual
-
Yes, that's the other way... but it has the same result. It would be great if RetroPie developers would put this option in RetroPie settings... some kind of switch "MicroSD / USB flash drive", because a lot of people needs this.
-
https://retropie.org.uk/forum/topic/2582/can-my-usb-device-have-data-on-it-already/5
No the result isn't the same if the USB flash drive is for example FAT32
-
I would highly recommend to "not" move /home/pi/RetroPie/* to /media/usb0/.
This will likely break things in the long run.Instead just make a copy of the folder /home/pi/RetroPie/roms
And place it on you usbstick "/home/pi/RetroPie/roms"First Disable USB transfer daemon
-
Enter the RetroPie Setup menu within the RetroPie menu in EmulationStation.
Select Setup / Tools.
Select usbromservice - USB ROM Service
Disable USB ROM Service. -
Step 1 – Plug In The Device
The first step is to plug in your USB stick.
- Step 2 – Identify The Devices Unique ID
In order to find the unique reference (UUID) for your drive run the following command in the terminal :
ls -l /dev/disk/by-uuid/
The line will usually refer to "/sda*" and in this example it is “sda1”. My ID is “18A9-9943”. Note down yours.
You would need to repeat this step if you wanted to use a different device as the UUID would be different.
- Step 3 – Create a Mount Point
A mount point is a directory that will point to the contents of your flash drive. Create a suitable folder :
sudo mkdir /media/usbstorage
I’m using “usbstorage” but you can give it whatever name you like. Keep it short as it saves typing later on.
Make pi the owner of the mounted drive and make its permissions read, write and execute for itsudo chown -R pi:pi /media/usbstorage sudo chmod -R 775 /media/usbstorage
Set all future permissions for the mount point to pi user and group (explanation can be found here)
sudo setfacl -Rdm g:pi:rwx /media/usbstorage sudo setfacl -Rm g:pi:rwx /media/usbstorage
- Determine the USB Hard Drive Format
You also need to know the file system the drive is formatted with
sudo blkid /dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="787C-2FD4" TYPE="vfat" /dev/mmcblk0p2: UUID="3d81d9e2-7d1b-4015-8c2c-29ec0875f762" TYPE="ext4" /dev/sda1: LABEL="retropie" UUID="18A9-9943" TYPE="`vfat"
- Now mount the usb stick in there. If it is NTFS you will need to install some utilities first
sudo apt-get install ntfs-3g -y
- If the drive is exfat install these utilities
sudo apt-get install exfat-utils -y
- For all drive types mount the usb with this command, -o insures pi is the owner which should avoid permission issues
sudo mount -o uid=pi,gid=pi /dev/sda1 /media/usbstorage
- If you get an error use this syntax
sudo mount -t uid=pi,gid=pi /dev/sda1 /media/usbstorage
- Automount the USB Hard Drive on Boot
/media/usbstorage will be the folder in which you store your media. We want it to be automounted on boot The best way to do this is through the UUID. Get the UUID by using this commmand
sudo ls -l /dev/disk/by-uuid/
- You will see some output like this. The UUID you want is formatted like this XXXX-XXXX for the sda1 drive. If the drive is NTFS it can have a longer format like UUID="BABA3C2CBA3BE413". Note this UUID, for me it is 18A9-9943
total 0 lrwxrwxrwx 1 root root 15 Jan 1 1970 3d81d9e2-7d1b-4015-8c2c-29ec0875f762 -> ../../mmcblk0p2 lrwxrwxrwx 1 root root 15 Jan 1 1970 787C-2FD4 -> ../../mmcblk0p1 lrwxrwxrwx 1 root root 10 Oct 26 21:10 18A9-9943 -> ../../sda1
- Now we will edit fstab to mount the USB by UUID on boot
sudo nano /etc/fstab
-
Add the line in red to the bottom, replace XXXX-XXXX with your UUID and exfat with your type if it is different (e.g. ntfs, vfat, ext4). You may or may not need the quotation marks wrapped around the UID, you do not need quotation marks wrapped around the file system type (ext4, vfat, NTFS etc).
-
The umask 0002 sets 775 permissions so the pi user and group can read, write and execute files on the external USB drive. To completely eliminate permission issues you can set the umask to 0000 which equals 777 permissions so anybody can read, write and execute. Note that 777 permissions are considered a security risk.
-
If you have issues here then try replacing uid=pi,gid=pi with just the word defaults (typical for ext4). You can also try replacing the UUID with the /dev/sda1 line.
-
This is an example for vfat
`/dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 errors=remount-ro,noatime 0 1 UUID=XXXX-XXXX /media/usbstorage vfat nofail,uid=pi,gid=pi 0 0
- This is an example for exfat
/dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 errors=remount-ro,noatime 0 1 UUID=XXXX-XXXX /media/usbstorage exfat nofail,uid=pi,gid=pi 0 0
- for NTFS, note that it is ntfs and not ntfs-3g
/dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 errors=remount-ro,noatime 0 1 UUID=XXXX-XXXX /media/usbstorage ntfs nofail,uid=pi,gid=pi 0 0
- for ext4 using uid and gid is not recommended so use at your own risk as it could cause issues
dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 errors=remount-ro,noatime 0 1 UUID=XXXX-XXXX /media/usbstorage ext4 nofail,uid=pi,gid=pi 0 0
- If you get any errors you can replace uid=pi,gid=pi with defaults or remove it entirely
/dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 errors=remount-ro,noatime 0 1 UUID=XXXX-XXXX /media/usbstorage ext4 nofail,defaults 0 0
- For using /dev/sda1 and defaults if you have troubles with UUID
/dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 errors=remount-ro,noatime 0 1 /dev/sda1 /media/usbstorage ext4 nofail 0 0
- Now test the fstab file works
sudo mount -a
- If you didn’t get errors reboot, otherwise try the suggestions above to get it working then mount -a again until it succeeds
sudo reboot
You should be able to access the mounted USB drive and list its contents
cd /media/usbstorage ls
Every time you reboot, the drives will be mounted as long as the UUID remains the same. If you delete the partitions or format the USB hard drive or stick the UUID changes so bear this in mind. You can always repeat the process for additional hard drives in the future.
If you have multiple hard drives you will have to make separate mount points (e.g. /media/usbstorage2) for each drive’s partition
- Now that's done lets make a copy of es_systems.cfg
It's located in this folder
/etc/emulationstation/es_systems.cfg
and copy it to this folder
/home/pi/.emulationstation/
This is a Symbolic link witch poinst to /opt/retropie/configs/all/emulationstation
EmulationStation first checks in /home/pi/.emulationstation and then checks /etc/emulationstation
- Edit es_systems.cfg to change the path to your mount point
Example
<name>amstradcpc</name> <fullname>Amstrad CPC</fullname> <path>/home/pi/RetroPie/roms/amstradcpc</path>
To
<name>amstradcpc</name> <fullname>Amstrad CPC</fullname> <path>/media/usbstorage/roms/amstradcpc</path>
A good freeware program that handles big files and is easy to use is Notepad++
Just do this- Search->Replace (Ctrl-H)
Find What: /home/pi/RetroPie/
Replace With: /media/usbstorage/This ensures that Emulationstation picks up your rom directory.
If you install new themes or systems the file will not be overwritten.More info about ES_Sytems.cfg on the wiki here
Edit
Made some changes and added guide for es_systems.cfg. -
-
@Rion Hehe :) We want easy solutions :)
+1 for your extended explanation and information about issues :D -
@cyperghost Thank you
I have probable missed something and i can make in a little bit more detailed regarding ES_Sytems.cfg..
-
@Rion
Yes but it's really better to use the fstab-method :)
Just for maintaining and helping the forum members :)
I also use the symbolic link but I know about it's weaks.And in your solution you may have to edit the
es_system.cfg
which isn't always a good deal... if you do not know what are you doing :) So the proper solution is @herb_fargus posted :) -
@cyperghost said in Run ROMs from USB flash drive instead of microSD card - manual:
We want easy solutions
There are no easy solutions, only small actors. Personally, I use the fstab method, but I believe every solution has a drawback or two.
-
@mediamogul I think the easiest solution will be a setup within RetroPie which scans all connected drives and asks for the current roms place for every emulator that can be selected by joypad control :)
-
The ability to run roms off of external media is probably the most requested feature that doesn't have a gui solution of any kind. RecalBox handles this from Emulation Station, but even a terminal menu would be a welcome addition. The other side of the argument is that there are so many ways to achieve this that leaving up to the user's own personal preference might be best.
-
@Rion Thank you, this might be a safe, but hard way... anyway thanks for explanation... It would be great if this would be implemented in next RetroPie version as simple swith SD / USB.
-
@Rion said in Run ROMs from USB flash drive instead of microSD card - manual:
I would highly recommend to "not" move /home/pi/RetroPie/* to /media/usb0/.
This will likely break things in the long run..... long posting :)
Rions' method got the big advantage to mount specific drives marked by an UUID.
So we can use several USB stick, HDDs.... whatever we want and every partition can be mounted seperatly. So we can use an old small USB stick for NES, SNES, Genesis Roms and we can use a big HDD with several GB to mount PSX, MAME, SCUMMVM and Dreamcast games for ex.The big clue is the
mount --bind
command.
The content of USB stick1 can be mounted to a specific folder maybe/home/pi/retropie/roms
and also the content of HDD1 can also be mountend to same location :)... Without editing RetroPies config data (es_systems.cfg
)Sometimes automount and it's specific USB0, USB1 method can cause errors, because sometimes the devices responds differently. So the volume identification via UUID is a good deal :)
Thanks again rion for your entry.
-
For multiple flash drives in one folder you can also use mhddfs: https://romanrm.net/mhddfs
That is probably the best solution, how you can merge all folders in one.
-
@Kreibich As you see there are several ways to solve one problem. But as I said some postings before...
Yes but it's really better to use the fstab-method :)
Just for maintaining and helping the forum members :)I suggest this thread as a infopool ;)
-
@cyperghost said in Run ROMs from USB flash drive instead of microSD card - manual:
@Rion said in Run ROMs from USB flash drive instead of microSD card - manual:
I would highly recommend to "not" move /home/pi/RetroPie/* to /media/usb0/.
This will likely break things in the long run..... long posting :)
Rions' method got the big advantage to mount specific drives marked by an UUID.
So we can use several USB stick, HDDs.... whatever we want and every partition can be mounted seperatly. So we can use an old small USB stick for NES, SNES, Genesis Roms and we can use a big HDD with several GB to mount PSX, MAME, SCUMMVM and Dreamcast games for ex.The big clue is the
mount --bind
command.
The content of USB stick1 can be mounted to a specific folder maybe/home/pi/retropie/roms
and also the content of HDD1 can also be mountend to same location :)... Without editing RetroPies config data (es_systems.cfg
)Sometimes automount and it's specific USB0, USB1 method can cause errors, because sometimes the devices responds differently. So the volume identification via UUID is a good deal :)
Thanks again rion for your entry.
mount --bind should work.
There is a Feature Request about it here
-
I just edit es_systems.cfg and make it point to /media/usb0/ done and done.
It does get overwritten with updates so I back it up. I wonder if I can make it read-only. -
Well, in my opinion mhddfs method is probably the best, because you don't care where the files are located. If there is no free space left on one device, it automatically switchs you to another and it looks still as one merged folder.
-
@Darksavior said in Run ROMs from USB flash drive instead of microSD card - manual:
I just edit es_systems.cfg and make it point to /media/usb0/ done and done.
It does get overwritten with updates so I back it up. I wonder if I can make it read-only.If you want to customise your es_systems.cfg or add themes without them being overwritten on updates you can add them to /home/pi/.emulationstation EmulationStation first checks in /home/pi/.emulationstation and then checks /etc/emulationstation.
-
@Kreibich said in Run ROMs from USB flash drive instead of microSD card - manual:
Well, in my opinion mhddfs method is probably the best, because you don't care where the files are located. If there is no free space left on one device, it automatically switchs you to another and it looks still as one merged folder.
I care where my files are located.
But i agree to disagree. We all have our own preferences. -
@Rion You can still view files separately in their original folders.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.