NFS mount with fstab vs autofs

Autofs , is auto mounting filesystem on demand like when ever you need it.

NFS is like mounting a complete partition remotely and you will have availability of whole content of the partition.

But there are few advantages with autofs over nfs

Advantages of AutoFS

1 Shares are accessed automatically and transparently when a user tries to access any files or directories under the designated mount point of the remote filesystem to be mounted.

2 Booting time is significantly reduced because no mounting is done at boot time.

3 Network access and efficiency are improved by reducing the number of permanently active mount points.

4 Failed mount requests can be reduced by designating alternate servers as the source of a filesystem.


The difference will affect you when the machine boots up (like after a reboot). Your NFS mount will not be present. With some Operating Systems the machine will not boot.

/etc/fstab is read early in the boot sequence to mount filesystems

autofs is a daemon started later in the boot sequence. At a high level:

  1. First your filesystems are mounted from /etc/fstab
  2. Next, your network is brought online
  3. Subsequently, the automounter daemon autofs starts up

I have seen a machine unable to boot because someone added the following to /etc/fstab:

10.1.2.3:/path/to/nfs/export /local/path

The machine tried and failed to load that NFS mount point because the network service had not yet started.

Tags:

Nfs

Autofs