Just a quick update to my Raspberry Pi set up.
The bug in mounting drives with the Raspberry Pi 2 required the work around outlined in the last post: code was added to
rc.local that caused a wait of 30 seconds before the
sudo mount -a command is run. If one has a daemon set to run on start up that requires either access to files on the mounted disk, or creates files on the mounted disks, problems can arise. For instance, if the daemon creates a file or directory in the mount directory before the
mount command is executed, the
mount command will fail complaining that the mount directory is non-empty.
In order to solve this problem, I looked for a way to modify the daemon init.d script to check if the relevant disks were mounted. I succeeded in finding the following code on the Raspbian part of Stack Exchange, which was easy enough to modify for my needs.
log_daemon_msg "Checking if shares are mounted" "$NAME" count=0 while [ ! -f /home/pi/nas/public/Downloads/check.txt ] do log_daemon_msg "Waiting 30 seconds to allow for mounting" "$NAME" sleep 30 count=$((count+1)) if [ $count -eq 10 ]; then log_daemon_msg "Giving up after 10 retries. Please check network and mounts" "$NAME" exit 1 fi done