NFS Mount Issues

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of doozy doozy 2 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #100333
    Profile photo of doozy
    doozy
    Participant

    Hi All,

    I’ve just installed Linux retropie 3.18.11-v7+ and I have configured it store the roms on the my home server using NFS shares. I have mounted an NFS share directly onto ~/RetroPie/roms using /etc/fstab.

    The problem I have is that the NFS shares don’t mount when the system boots. I guess its because it tries to mount before the network is ready?

    If I quit my emulationstation front end and issue a “sudo mount -a” everything mounts fine and I can run emulationstation and play games etc.

    I edited /usr/bin/emulationstation and added a “sudo mount -a” at the beginning. This does not help when the device first boots, the mounting still doesn’t happen. However, if I quit emulationstation and reload it everything mounts fine.

    So I need some advice on how to delay the startup a little to allow time for the network to come up and everything to mount properly before emulationstation front end is launched.

    any ideas or thoughts?

    #100337
    Profile photo of same
    same
    Participant

    Hi doozy,

    Had the same issue and found a post in this forum with a script made by erdnuesse member, I modified it a bit for my needs and here it goes:

    Just after the #!/bin/bash in /usr/bin/emulationstation:

    # Thx erdnuesse
    # Set retry to the number of times you want the loop to repeat
    RETRY=20
    
    # As long as we have retries left...
    if [ `mount -l -t nfs | wc -l` -eq 0 ]; then 
        while [ $RETRY -gt 0 ]; do
            # This will become true if 'ping' gets a response
            # Modify the following IP with your server address
            if ping -c 1 -W 1 192.168.1.7 > /dev/null ; then
    	    echo "Mounting NFS Shares..."
                sudo mount -a -t nfs
    	    RETRY=0
            else
                # Wait for 1 second 
                sleep 1
                RETRY=$((RETRY - 1))
                if [ $RETRY -eq 0 ]; then
                    echo "[ERROR] NFS Failed to mount: server sent no response to ping."
                fi
            fi
        done
    else
        echo "Note: NFS Shares already mounted."
    fi

    Hope it helps !

    #100359
    Profile photo of same
    same
    Participant

    I just edited my previous post, as I had troubles to get the backticks appearing in the code block, I also misplaced one…

    Should be fixed now.

    #100380
    Profile photo of doozy
    doozy
    Participant

    Spot on!

    Just what I needed. One day I will learn to write scripts like that!

    Cheers same

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

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

Skip to toolbar