{"id":1760,"date":"2016-08-10T02:57:10","date_gmt":"2016-08-10T08:57:10","guid":{"rendered":"http:\/\/www.supportpro.com\/blog\/?p=1760"},"modified":"2019-10-30T00:52:01","modified_gmt":"2019-10-30T06:52:01","slug":"network-file-system-nfs-on-centos-6","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/network-file-system-nfs-on-centos-6\/","title":{"rendered":"Network File System ( NFS ) on CentOS 6"},"content":{"rendered":"<p>The <strong>Network File System (NFS)<\/strong> was originally developed by SUN Micro-systems that allows communications between Linux\/Unix systems. It allows you to mount your local file systems over a network and remote hosts or clients to interact with them as they are mounted locally on the same system.<\/p>\n<p><a class=\"lightbox\" href=\"http:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2016\/09\/nfs1.jpg\" data-rel=\"penci-gallery-image-content\"  rel=\"attachment wp-att-1761\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-1761\" src=\"http:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2016\/09\/nfs1.jpg\" alt=\"nfs1\" width=\"461\" height=\"273\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2016\/09\/nfs1.jpg 610w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2016\/09\/nfs1-300x178.jpg 300w\" sizes=\"(max-width: 461px) 100vw, 461px\" \/><\/a><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Benefits<\/strong><\/span><\/p>\n<p>&gt;&gt; Central Data Management.<br \/>\n&gt;&gt; Allows local access to remote files transparently.<br \/>\n&gt;&gt; Very good for local or reliable connections<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Important NFS configuration file<\/strong><\/span><\/p>\n<p><strong>\/etc\/exports<\/strong> : All files and directories which need to be exported are defined in this which is located in server.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Setup<\/strong><\/span><\/p>\n<p>Need to have two CentOS systems :<br \/>\n<strong>NFS Server<\/strong><br \/>\n<strong>NFS Client\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Server<\/strong><\/span><\/p>\n<p><em>yum install nfs-utils nfs-utils-lib<\/em><br \/>\n<em>chkconfig &#8211;levels 235 nfs on<\/em><br \/>\n<em>service nfs start<\/em><\/p>\n<p>Here we are going to share the<em> \/home<\/em> directory in the server using NFS. To share this we need to add this directory to be shared and the details of how it is shared in \/etc\/exports file.<\/p>\n<p><em>vi \/etc\/exports<\/em><\/p>\n<p>Here we are going to add the below line in the above file<\/p>\n<p><em>\/home\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 192.168.0.xx(rw,sync,no_root_squash,no_subtree_check)<\/em><\/p>\n<p>rw : This allows the client to read and write in the shared directory<br \/>\nsync : Sync confirms requests to the shared directory only once the changes have been committed.<br \/>\nno_root_squash : This allows \/home accessed as root.<br \/>\nno_subtree_check : This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.<\/p>\n<p>Once you entered the above entry, we need to export them by using below command.<\/p>\n<p><em>exportfs -a<\/em><\/p>\n<p>Note : We need to run this command for every update we make in the \/etc\/exports file.<\/p>\n<p><em>exportfs -r<\/em><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Client<\/strong><\/span><\/p>\n<p><em>yum install nfs-utils nfs-utils-lib<\/em><\/p>\n<p>Then we need to create a directory in client system where we want to mount NFS shares. For e.g.:<\/p>\n<p><em>mkdir \/mnt\/nfsshare<\/em><\/p>\n<p>We can see the available list of NFS shares using :<\/p>\n<p><em>showmount -e &lt;server_ip or hostname&gt;<\/em><\/p>\n<p>For mounting :<\/p>\n<p><em>mount &lt;server_ip&gt;:\/home\u00a0 \/mnt\/nfsshare<\/em><\/p>\n<p>We can check whether the directory is mounted by :<\/p>\n<p><em>df -h<\/em><\/p>\n<p>We can additionally verify it using:<\/p>\n<p><em>mount | grep nfs<\/em><\/p>\n<p>For mounting NFS shares at boot time.<\/p>\n<p><em>vi \/etc\/fstab<\/em><\/p>\n<p>Now enter the following line in above file:<\/p>\n<p><em>&lt;server_ip&gt;:\/home\u00a0 \/mnt\/nfs\/home\u00a0\u00a0 nfs\u00a0\u00a0\u00a0\u00a0\u00a0 rw,sync,hard,intr\u00a0 0\u00a0\u00a0\u00a0\u00a0 0<\/em><\/p>\n<p>To unmount NFS shares:<\/p>\n<p><em>umount \/mnt\/nfsshare<\/em><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Testing<\/strong><\/span><\/p>\n<p><strong>Client : <\/strong><\/p>\n<p><em>touch \/mnt\/nfsshare\/hello.txt<\/em><\/p>\n<p><strong>Server :<\/strong><\/p>\n<p><em>ls \/home<\/em><\/p>\n<p>You will be able to see the hello.txt file in the above location.<\/p>\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/www.supportpro.com\/freecheckup.php\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '9d590242-d641-4383-94b4-8cfd62f0af6b', {}); <\/script><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Network File System (NFS) was originally developed by SUN Micro-systems that allows communications between Linux\/Unix systems. It allows you to mount your local file systems over a network and&hellip;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[5,6,3],"tags":[],"class_list":["post-1760","post","type-post","status-publish","format-standard","hentry","category-general-topics","category-linux-basics","category-technical-articles"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=1760"}],"version-history":[{"count":3,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1760\/revisions"}],"predecessor-version":[{"id":4401,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1760\/revisions\/4401"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=1760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=1760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=1760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}