In the Linux world, using the AutoMounter (autofs) to automatically mount remote NFS filesystems is relatively uncommon. However, in the Solaris universe this is the status quo. One of the most common uses of the automounter is what is known as the /net filesystem.
Many Linux users who have not spent time in the UNIX world may never have come across this and are often unaware that it even exists. It is, however, extremely important for even home users who have multiple UNIX (or Windows with NFS) fileservers and who want to make accessing those resources as easy as possible. For small businesses it goes far beyond simple convenience.
If you are used to Solaris than you probably know that /net functionality is enabled by default. In Linux the functionality is usually present and provided by the vendor (Novell and RedHat both build this in) but it is generally disabled by default. So all we have to do is enable it to turn it on and this is very simple.
Note to Novell and RedHat: Linux users would love /net mounting to be enabled by default. I suggest enabling this and putting a note in /etc/auto.master explaining how to disable. Or, better yet, make it configurable and obvious through Yast or Sysconfig.
Automounting behaviour is controlled by the configuration file /etc/auto.master. Within this file are pointers to other files that control groups of automount points. By default in OpenSuse 10.x there are several configuration file pointers that are commented out but ready for you to use. They look like this:
#/misc /etc/auto.misc --timeout=60
#/smb /etc/auto.smb
#/misc /etc/auto.misc
#/net /etc/auto.net
It is the final line that we are interested in. The file /etc/auto.net (which is wildly different than its Solaris counterpart) contains a BASH script that hands the automounting in the /net directory. You do not need to make any modifications to /etc/auto.net. Be sure not to make it non-executable as you will need it to “run” in order to complete your mounting tasks.
So, simply delete the # from in front of the #/net /etc/auto.net
line in our /etc/auto.master file and restart the automount daemon and we should be good to go.
/etc/init.d/autofs restart
Now you can easily mount NFS shares on your other hosts. It is as easy as moving into the /net directory. Here is an example:
cd /net/hostname/exportedspace/home/myhome/stuff