Max2Play Home › Forums › Max2Play Add-ons › [SOLVED] Mount only if the NAS is running…
Tagged: CIFS Mount NAS
- This topic has 5 replies, 3 voices, and was last updated 7 years, 9 months ago by Mbydeen.
-
Posted in: Max2Play Add-ons
-
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 #25567Hi 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 #25928Hello 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 #26027Okay,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 #27357Alright, 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, mounthere’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!
-
You must be logged in to reply to this topic.