Roms via NFS over WIFI

Tagged: , ,

This topic contains 13 replies, has 4 voices, and was last updated by  arbe 2 years, 8 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #3229

    erdnuesse
    Participant

    Hi,
    first of all, thank you so much for bringing this all together.
    I have a weird issue, but am not sure if it’s a retropie thing at all, maybe not.

    I am trying to set up a rom filebase on my nfs storage, so I don’t have to worry about space on my 4GB SD. When I boot up the pi, it connects fine to the WIFI, and ES starts.
    Then I mount (after closing ES) a first NFS share directly into one of the rom folders, which gets connected just fine, and I can access and r/w it. Starting ES afterwards loads roms also fine, as I can see them appearing as emu and start them.
    My problem is, that ES does not recognize the nfs share after launch so I put the mount simply into /etc/fstab.
    After doing so, my WIFI won’t connect any longer, and thus, I don’t get a connection to my nfs share nor can ssh into the pi.
    commenting the line in fstab solves the wifi issue, but then, as said, it won’t aoutomount.
    Have you – or anyone experienced this issue or am I just forgetting something?

    #3230

    erdnuesse
    Participant

    EDIT: I will try autofs next.

    #3464

    chrishsin
    Participant

    you can try mount nfs in /etc/rc.local

    #3469

    erdnuesse
    Participant

    1. autofs s*cks.
    2. /etc/rc.local must include sleep 30 / a ping check to the nfs storage, / mount only if successful, then exit. Gotta check on how to script it correctly. Last scripting-time is long ago : (

    #3505

    aergan
    Participant

    Are you using the _netdev mount option?
    https://help.ubuntu.com/community/NFSv4Howto

    I’m using SAMBA/CIFS here but I get similar behaviour without it.

    #3567

    erdnuesse
    Participant

    I inserted this right above the exit 0 entry in /etc/rc.local
    Remember:
    1. I won’t be responsible for any damages you cause from information given here
    2. try your mount commands first, before you insert them
    3. replace the ip with the ip of your nfs storage

    # Set retry to the number of times you want the loop to repeat
    RETRY=20
    
    # As long as we have retries left...
    while [ $RETRY -gt 0 ]; do
        # this will become true if 'ping' gets a response
        if ping -c 1 -W 1 192.168.0.1 > /dev/null ; then
            # insert all your mounts here
            mount -t nfs 192.168.0.1:/path/to/roms/snes /home/pi/RetroPie/roms/snes
            mount -t nfs 192.168.0.1:/path/to/roms/nes /home/pi/RetroPie/roms/nes
            echo "NFS mounted"
            RETRY=0
        # and if there's no response...
        else
            # set sleep higher if you want to wait more than 1sec between attempts
            sleep 1
            RETRY=$((RETRY - 1))
            if [ $RETRY -eq 0 ]; then
                echo "NFS Failed to mount, server sent no echo response"
            fi
        fi
    done

    Thanks to chrishsin for pointing me there.

    #3573

    erdnuesse
    Participant

    I have made some interesting experiences with mounting multiple folders which brought me to the ideaof mounting only the roms folder directly. It just did not work flawlessly.

    So what I did was:

    cd /home/pi/RetroPie/
    mkdir oldromfolders
    cd roms
    mv * ../oldromfolders/

    in order to get rid of everything inside the rom folder.

    after that I changed my script to include only one mount command
    mount -t nfs 192.168.0.1:/path/to/nfs/roms /home/pi/RetroPie/roms
    Which worked just fine.

    If you have a problem that ES won’t start (white dot), it might be because the paths in /home/pi/.emulationstation/es_systems.cfg got messed up or you renamed a folder incorrectly. (for me at least)

    Still testing the setup, so marked as unsolved – but on a good way here.

    #85284

    erdnuesse
    Participant

    Okay, so here we go.

    What remains open is the part where I only mount one folder “roms/”.
    But my mounts in .profile and rc.local totally went south.

    Prerequisites:

    • empty rom folders on the pi – because I mount the nfs folders into the existing rom folders
    • a working nfs share on your IP (replace 192.168.2.1 with your nfs share)
    • What I now did was edit the file /usr/bin/emulationstation
      and inserted the following code right after

      #!/bin/bash

      # Set retry to the number of times you want the loop to repeat
      RETRY=20
      
      # As long as we have retries left...
      while [ $RETRY -gt 0 ]; do
          # this will become true if 'ping' gets a response
          if ping -c 1 -W 1 192.168.2.1 > /dev/null ; then
              # insert all your mounts here 
              sudo mount -t nfs 192.168.2.1:/volume1/shares/games/roms/snes /home/pi/RetroPie/roms/snes
              sudo mount -t nfs 192.168.2.1:/volume1/shares/games/roms/nes /home/pi/RetroPie/roms/nes
              RETRY=0
          # and if there's no response...
          else
              # set sleep higher if you want to wait more than 1sec between attempts
              sleep 1
              RETRY=$((RETRY - 1))
              if [ $RETRY -eq 0 ]; then
                  echo "NFS Failed to mount, server sent no echo response, or check your network connectivity"
              fi
          fi
      done
      

      As long as your network connection is set up (I had minor problems with wifi) your mounts should come up and running. When you see the emus in emulationstation, everything should be fine.

      Consider this one solved. But: I may reserve a post, for when I will be able to replace the multiple mountpoints by a single one for all emulators. (I might run into an issue due to too many mounts for that little box and my 54Mbit wifi)

    #85288

    erdnuesse
    Participant

    <Reserved for the single-mount thingy>

    #89046

    arbe
    Participant

    Hi,

    I discovered this project just a couple of days ago. I kept trying to find cool stuff to do with my pi, and this project is just amazing, thanks!

    I was trying to do the same a couple of weeks ago. Similar scenario, roms on a NAS, accessed through NFS and WIFI.
    I had a empty /home/pi/RetroPie/roms folder, where I would mount my nfs share. And the nfs share will store roms just the way RetroPie expects them as configured by default on its es_systems.cfg file.

    The problem I kept having was with mount permissions though. When adding the mount options on fstab, the directory would get mounted but won’t be readable by the pi user, even if directory permissions were fine before mounting. I didn’t try too hard, since I wanted to see the thing working first (I hadn’t even tried to have it working from the default roms folder)!

    I will look into adding the mount commands on emulationstation as you did, that way I think I’ll get it right.

    Just one thing I don’t get. What’s the problem exactly with the single mount?

    #89071

    erdnuesse
    Participant

    Hi,

    since I did not want to delete rom directories from the basic install of the retropie, I couldn’t test it.
    Basically it’s one thing:
    AFAIK, I can not mount nfs into a non-empty directory.

    Another thing – when I want to have it portable to take it to a friend, I might not have my nfs share available (I don’t want to be dependent on having Internet available for a vpn) so I was thinking on having some rom folders on a USB drive, which mounts if I have no connection to my NAS.
    That would be single mount or rom-specific.
    Since I did not try that as well, I left the rom directories as-is.
    That’s all.
    If you get it to work, please let us know.

    All the best,
    erdnuesse

    #89088

    arbe
    Participant

    I got it to work, but I didn’t really had to do much.

    All of my problems were really about nfs permissions and were on the NAS config side.

    Once those were fixed and I could mount without any problem, I didn’t even need any of the sync code on emulationstation. I have an entry on /etc/fstab and it just loads fine every time…

    192.168.1.100:/volume1/games/roms /home/pi/RetroPie/roms nfs defaults 0 0

    In my case I’m linking the whole roms folder, which I initially copied over to my NAS as it comes by default on RetroPie.

    I like the usb idea though for whenever there’s no access to nfs. Even if it’s not a USB drive, the SD card could be just fine. Just having a folder on the SD following same roms folder structure, say /home/pi/RetroPie/romslocal, but just with a couple of cool roms, and have emulationstation use it when nfs mount fails. Not sure how I could get romslocal be “mounted” on /home/pi/RetroPie/roms, since it’s not really a device.

    Another option I’m thinking would be to have two different copies of the es_systems.cfg file, es_systems.cfg.nfs and es_systems.cfg.local, and depending on whether nfs is available or not, copy the right one to es_systems.cfg on the emulationstation script. But yeah…two config files to maintain.

    In your case, and since you have all that sync code on emulationstation anyway, probably it won’t be too hard for you to add a couple of lines after all the nfs mount retries to try the alternate USB drive mount…

    #89123

    erdnuesse
    Participant

    Hi,

    I’m going towards a minimal install on SD (4GB) and a rather big usb (nano) pen drive for the roms, because you can have p.e. 16 Gigs of roms separately, mountable and safe from corruption which occurs mostly on SDs.
    When I manage to save rom states on usb on the fly (inside the rom folder), I surely don’t want any data corruption.

    One more thing: I guess you’re using wired network – I am using wifi, which is why I needed to tweak my mounts because wifi’s not always ready when using default fstab.

    Regards.

    #89237

    arbe
    Participant

    Nope, also using wifi indeed… I hadn’t had any sync issue and fstab is mounting the nfs share each time.

    I’m using this device: http://www.amazon.com/TP-LINK-TL-WN725N-Wireless-Adapter-Miniature/dp/B008IFXQFU

Viewing 14 posts - 1 through 14 (of 14 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/