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 :
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”.
[[email protected] ~]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 = 184.108.40.206
Share Name Â Â = sales
Point above mentioned nfs share information in “/etc/auto.misc” file like this.
[[email protected] ~]vi /etc/auto.misc
sales -fstype=nfs,intr 220.127.116.11:/sales
save & exit.
Above mentioned lines “sales -fstype=nfs,intr 18.104.22.168:/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 “22.214.171.124:/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.
[[email protected] ~]# ls /misc/sales Annual_Sales_Report.xls
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.