{"id":83,"date":"2015-06-05T14:49:40","date_gmt":"2015-06-05T14:49:40","guid":{"rendered":"http:\/\/star.genuinewebhost.com\/~linuxguru\/tutorial\/?p=83"},"modified":"2018-01-04T09:40:14","modified_gmt":"2018-01-04T09:40:14","slug":"how-to-mount-an-nfs-share-using-autofs-in-linux-hosts","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=83","title":{"rendered":"How to mount an NFS share using autofs in Linux hosts"},"content":{"rendered":"<p>At times it may be desired not to add a mount point permanently via the \/etc\/fstab, but just automatically mount when the user just desires to access a particular share. This is a scenario when a host admin want to make a shared folder available to users without they manually making them mount the share, but enabling the host to automatically noun the share when the users access the mount point.<\/p>\n<p>Autofs uses the auto mount daemon. It \u00a0manages the mount points by mounting them dynamically when they are accessed by users.<\/p>\n<p>Procedure to mount an NFS share &#8220;92.168.3.22:\/nfs_mymount&#8221; using autofs.<\/p>\n<ul>\n<li>Ensure the packages &#8220;nfs-utils&#8221; is installed in our client host<\/li>\n<li>Ensure the share is accessible from our client host. This can be verified by using the &#8220;<strong>showmount -e 192.168.3.22<\/strong>&#8221; command, and also my manually mounting the share to check. This is a very important step.<\/li>\n<li>Ensure the package &#8220;autofs&#8221; is installed by issuing the command &#8220;<strong>rpm -qa | grep autofs<\/strong>&#8220;<\/li>\n<li>Start the autofs service using the command &#8220;<strong>service autofs start&#8221;<\/strong>, and permanently making it after reboots using the command &#8220;<strong>chkconfig autofs on<\/strong>&#8220;<\/li>\n<li>Edit the file &#8220;<em>\/etc\/auto.master<\/em>&#8220;, and ensure the line starting with &#8220;\/misc&#8221; is not commented.<\/li>\n<li>Edit the file &#8220;<em>\/etc\/auto.misc<\/em>&#8221; and add the line &#8220;<strong>mynfs -rw 192.168.3.22:\/nfs_mymount<\/strong>&#8220;<\/li>\n<li>Ensure the folder &#8220;\/misc&#8221; exists un the root directory.<\/li>\n<li>Restart autofs service by using the command &#8220;<strong>service autofs restart<\/strong>&#8220;<\/li>\n<li>Try accessing the \u00a0folder by issuing the command &#8220;<strong>cd \/misc\/mynfs<\/strong>&#8220;<\/li>\n<\/ul>\n<p>The time one accessed this folder, the share will be automatically mounted.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>At times it may be desired not to add a mount point permanently via the \/etc\/fstab, but just automatically mount when the user just desires <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=83\" title=\"How to mount an NFS share using autofs in Linux hosts\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":267,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,11],"tags":[],"class_list":["post-83","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-nfs"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=83"}],"version-history":[{"count":3,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":86,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions\/86"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/267"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}