Comment 1 for bug 1095917

Revision history for this message
Chris Good (chris-good) wrote : Re: nfs mounts failing during reboot 12.04

I have worked around the problem by running a script during reboot which sleeps for 30 seconds, then mounts any unmounted nsf file systems.

Add to /etc/rc.local :

nohup /usr/local/bin/nfs_fix >/tmp/nfs_fix.out 2>&1 &

/usr/local/bin/nfs_fix :

#!/bin/ksh

# /usr/local/bin/nfs_fix

# Do to timing problem causing some nfs mounts to fail during reboot,
# this script is initiated from /etc/rc.local.

do_fix_nfs()
{
        echo Checking $1
        if df | grep $1 >/dev/null ; then
                echo $1 is already mounted
        else
                echo Mounting $1
                mount $1
        fi
}

sleep 30 # wait for networking to start

awk '($3=="nfs") {print $2;}' /etc/fstab |
grep -v '^#' > /tmp/nfs_fix.fs

while read fs ; do
        do_fix_nfs $fs
done < /tmp/nfs_fix.fs