[SOLVED] Mount only if the NAS is running…

Max2Play Home Forums Max2Play Add-ons [SOLVED] Mount only if the NAS is running…

Viewing 6 posts - 1 through 6 (of 6 total)
  • 27. Dezember 2016 at 18:13 #25263

    Hi everybody,

    my RasPi is powered by the USB port of my NAS – works fine.
    However the RasPi boots much faster than the nas resulting in an empty mount directory.
    The only way to resolve this for now is rebooting my RasPi again once the NAS is up and running.

    I think i would need some mount script that periodocally checks if the NAS is up before mounting, but maybe one of you has got a better/easier solution…

    Thanks for any hints

    5. Januar 2017 at 15:46 #25567

    Hi GumbyMan,

    Sorry about the late response. If you are using the device for the LMS, you might want to check out our feature for delayed start on boot (it’s in the Squeezebox Server menu). This results in the server starting delayed and thus scanning and indexing the files later when your NAS is ready.

    16. Januar 2017 at 13:09 #25928

    Hello Heiner,

    thanks for your reply. But this didn’t work.
    The problem is not the scanning of the files.

    When my Raspi is booting, it mounts the network share which stores all of the music.
    But the NAS is still booting when the RasPi is trying to mount. Since the mount fails, the corresponding directory is empty.

    If I reboot the RasPi or if i mount manuall once the NAS is running everything is fine.
    So I’m looking for a script that delays the mount until the NAS is ready.

    But it is not that urgent.

    18. Januar 2017 at 15:12 #26027

    Okay,Gotcha. Here are a few solutions detailed you could try to solve your issue: http://raspberrypi.stackexchange.com/questions/33037/how-to-add-delay-at-boot

    28. Februar 2017 at 23:40 #27357

    Alright, I got it working. Instead of delaying at boot, i added a script that does the following:
    If the directory is mounted –> do nothing
    If the directory is not mounted:
    – check if the NAS is reachable (using ping)
    – if yes, mount

    here’s my code (don’t forget to add noauto to your mountpoint in fstab)

    
    #!/bin/bash
    
    if mount | grep /mnt/Music > /dev/null; then
            echo "/mnt/Music already mounted - nothing to do"
    else
            echo "/mnt/Music not mounted, pinging discworld"
            if ping -c 2 "myServer" >/dev/null; then
                    mount /mnt/Music
                    echo "/mnt/Music successfully mounted"
            fi
    fi
    

    in the end, i’m calling this script every minute in crontab:

    * * * * * root /usr/local/bin/mount_nas.sh
    

    Thanks for your help heiner!

    • This reply was modified 7 years, 8 months ago by GumbyMan.
    • This reply was modified 7 years, 8 months ago by GumbyMan. Reason: Corrected typo and added information about noauto in fstab
    1. März 2017 at 12:38 #27365

    Hi GumbyMan

    We are happy that you solved your problem and thank you for sharing the solution 🙂

    Regards,
    Mohammad Mbydeen

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

You must be logged in to reply to this topic.

Register here