Autofs Service is used for mounting network shares on a Linux machine it is Specially designed for saving your system and network resources. The benefit of using autofs service is that the shares unmounted after a specific time and when user need to access the resources it automatically mount that shares again.

By default an autofs share will be automatically unmounted after 10 minutes if nobody access it. We can even mount Microsoft windows Share on linux  using autofs service.

`

Main Config file :

/etc/auto.master

We can use this file to configure mapping to the other files that contains the information of mounting shares.we can also create a separate configuration file and create autofs mount point by following the format of “auto.misc” file.

If we look at this file there is an entry pointing a file located at “/etc/auto.misc”.

[root@w1 ~]vi /etc/auto.master
/misc			/etc/auto.misc

The above entry means all shares that will be configure in “/etc/auto.misc” file will be mounted “/misc” Directory.

By default in “/etc/auto.misc” some commented examples of locations and device are there that can be automatically mounted if a user try to access them.

Let’s suppose we have share available on NFS server shared named. “sales”
NFS Server IP = 1.1.1.1
Share Name    = sales

Point above mentioned nfs share information in “/etc/auto.misc” file like this.

[root@w1 ~]vi /etc/auto.misc
sales	-fstype=nfs,intr	1.1.1.1:/sales

save & exit.

Above mentioned lines “sales -fstype=nfs,intr 1.1.1.1:/sales” mean a share under “/misc/sales” with file type  “nfs” and “intr” mount option (short for interrupt), what is that mean ? In case a user trying to access NFS Server and for some reason Server is not reachable the “intr” option will take care about client’s system not to be hang.

At last “1.1.1.1:/sales”  path for nfs share on the server.

Time to restart “autofs” service 🙂

service autofs restart

Now verify the settings share will be available or not.

[root@w1 ~]# ls /misc/sales
Annual_Sales_Report.xls

Backup  :
We can see “Annual_Sales_Report.xls” file which is available on NFS Server means everything working fine …!!!! 🙂

Please use comment section to ask any help.
Thanks.

Similar Posts