9

What is the difference between using auto.master and having autofs automount your NFS mountpoints versus just putting the info in fstab? Linux Red-Hat 5/6

6

With fstab, the advantage is the remote filesystem will be mounted on system (when the noauto mount option is not used).

Additionally, it depends how the mount point is defined. There are two options which determines the recovery behaviour when the NFS client can't reach the server. With the hard option (default one), the boot process will pause if there is a problem mounting the nfs share and repeated tries are made to mount the share indefinitely. If the soft option is used, then the mount fails after retrans retransmissions have been sent.

On the other hand, autofs only mounts nfs shares when they are needed and accessed.

  • That was my understanding of autofs as well; so autofs will react to a stat, or other filesystem request which references that mountpoint by first mounting the NFS volume and then completing the request? Does it immediately unmount the NFS after the operation completes? – Gregg Leventhal Dec 21 '13 at 18:12
  • @GreggLeventhal autofs can be configured to unmount after a period of inactivity. Setting the timeout to 0 would not be a good idea since it would lead to very frequent unmount-mount cycles when you access two files in succession. – Gilles Dec 21 '13 at 23:51
  • What is the benefit to that versus leaving it mounted via fstab? – Gregg Leventhal Dec 22 '13 at 15:06
5

The benefit of autofs would be you can boot your server (and use it) as normal when an NFS mount is inaccessible. Only the user/application that wants to access the NFS mount will notice the unavailability. With fstab your server might refuse to boot (hard option), boot very slowly (hard option with timeout), or you might have to manually re-mount the unavailable NFS mount each time it failed (soft option). Please someone correct me if I'm wrong.

  • I found this article which adds at least one point to this answer: golinuxhub.com/2014/09/… – MrMas Feb 2 '16 at 16:30
  • Just as a side tip, I don't know if it's a standard, but fstab on Ubuntu/Debian have nofail option which would prevent boot failure on unavailable fs targets – JacopKane Jan 31 at 0:30
1

Generally as we know mounting at boot happens with/etc/fstab whereas autofs is the daemon that happens later. so generally it's good to have NFS shares on autofs so that there will not be any problem during boot process if NFS shares failed to load (happens sometimes). Advantage of autofs is due to autofs boot time is reduced because of unnecessary Mount point are reduced. Automatically unmount is also done as per the period. Network efficiency is increased.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.