Linux – automatically mounting nfs shares on debian

linux

I have a problem with automatically mounting nfs shares on my debian server.

The server structure is a bit complicated. I have got a mac mini server with mac os x 10.7 and I am runnning Debian squeez on a Oracle VirtualBox 4.1.12 VM. Now the idea is to mount 2 directorys from the mac as nfs shares.

The mac config /etc/exports

/ws_home -maproot=root ip.from.the.debian
/ws_data -maproot=root ip.from.the.debian

The /etc/fstab from the debian server

ip.from.the.mac:/ws_data /data nfs rw,hard,intr,async,nodev,nosuid 0 0
ip.from.the.mac:/ws_home /home nfs rw,hard,intr,async,nodev,nosuid 0 0

Now when I mount -a it works perfectly but on reboot the shares are not automatically mounted and I don't understand why or what I have to do to get it auto mounted.

I also tryed to add a auto flag to the fstab

ip.from.the.mac:/ws_data /data nfs rw,hard,intr,async,nodev,nosuid,auto 0 0

but that did not change anything

Best Answer

As suggested by @hornetbss, you probably need to delay the mounting of the nfs shares until network is up. You should be able to achieve this by adding _netdev as an option to the shares.

ip.from.the.mac:/ws_data /data nfs _netdev,rw,hard,intr,async,nodev,nosuid 0 0

There are also options fg and bg for re-trying the mounting (in foreground or background), if the first time fails.

Other possibility would be using autofs, which automatically mounts the drive when it is accessed.

Related Question