How to setup Automount/Autofs

Solution 1:

If your server name is ubuntu-server, /nfs/tutu where to mount the nfs share, then in /etc/auto.nfs:

tutu -fstype=nfs4 ubuntu-server:/

and then run:

sudo invoke-rc.d autofs restart

ls /nfs/tutu

Solution 2:

Here's my auto.master file for reference :

/etc/auto.master

+auto.master
/smb /etc/auto.smb uid=1000,gid=1000,--timeout=300 --ghost

For my samba share, that's all I need to do to see my shares listed :

scaine@GroovyTosh:~$ ls /smb/core
Archive  Backups  Data  Live

Due to a bug in smbclient, I have to specify the UID and GID. The timeout is how long before autofs unmounts an unused share and the ghost option keeps previously created folders in place inside /smb even when the share is not available.

I can also browse my /smb by IP address (e.g. ls /smb/192.168.1.10).

In your case, you might want to try the /net option, instead of manually specifying your exports. So your auto.master would simply be :

+auto.master
/net /etc/auto.net --timeout=300 --ghost

Then after a sudo service autofs restart, try ls /net.