| « HOWTO Handcraft network configurations | HOWTO install NFS on Fedora » |
With autofs, the file systems are mounted as required or on demand, and then automatically unmounted when they have not been used for some time. This means you can have two machines both of which mount file systems from the other and the order you boot them does not
matter as long as the remote system is not required during the boot.
Before we begin you will need a machine that is exporting some shares over NFS so see my HOWTO install NFS on Fedora page for getting that setup first. I'll wait. ![]()
So now you know how to setup NFS and get some directories shared.
Installing the software on Fedora is as easy as any other with yum.
That will also install a number of configuration files into /etc and one in /etc/sysconfig.
To set up a the automounts for the NFS shares being exported by a server we need to edit the file /etc/auto.master adding one line. Using the shares from a machine called linux32. we will be mounting them locally in /net/linux32/
The file in the middle does not exist, yet, we are about to create it.
You will need a line similar to the one above for each share from linux32. The magic of automounting is that you do not need to create all the local mount point directories yourself. they will be created and deleted as necessary. The entry in auto.master will create the first two directories /net and /net/linux32.
To explain the layout of auto.nfslinux32. The first parameter is the mount point on the local machine. In this case home which means you will access the fs via /net/linux32/home. The next parameter -fstype gives the mounting options note it is an fs type of 'nfs'.
The remaining options are from mount and fstab. Take a look at the man pages you may not want to use these.
Make sure that the autofs service will startup at boot time. If not set it so it will.
Start, stop and reload the files for autofs without rebooting using the usual service command.
Very similar automounting will be done automatically when the mount point starts with /net. I found there were a few annoyances using the automatic configuration so I do the above.
You may like to turn on the browse mode. This does have one downside in that it means that the auto mounts will be mounted each time you access the root directory where they are mounted.
Edit the file /etc/sysconfig/autofs changing the BROWSE_MODE flag to "yes" and reloading autofs