{"id":303,"date":"2016-08-18T04:00:10","date_gmt":"2016-08-17T21:00:10","guid":{"rendered":"http:\/\/www.rickyadams.com\/wp\/?p=303"},"modified":"2016-08-18T04:48:55","modified_gmt":"2016-08-17T21:48:55","slug":"mounting-nfs-volumes-in-linux-using-mount-or-etcfstab","status":"publish","type":"post","link":"https:\/\/www.rickyadams.com\/wp\/mounting-nfs-volumes-in-linux-using-mount-or-etcfstab\/","title":{"rendered":"Mounting NFS Volumes in Linux using mount or \/etc\/fstab"},"content":{"rendered":"<p>What a Linux hodge-podge&#8230;<\/p>\n<h2><span style=\"text-decoration: underline;\">Command Line approach<\/span><\/h2>\n<h2 class=\"title\"><a id=\"s1-nfs-client-config\"><\/a>19.2.\u00a0NFS Client Configuration<\/h2>\n<p>NFS shares are mounted on the client side using the <code class=\"command\"><span style=\"font-family: Courier New;\">mount<\/span><\/code> command. The format of the command is as follows:<\/p>\n<pre class=\"screen\"><code class=\"command\">mount -t <em class=\"replaceable\"><code>&lt;nfs-type&gt;<\/code><\/em> -o <em class=\"replaceable\"><code>&lt;options&gt;<\/code><\/em><em class=\"replaceable\"><code>&lt;host&gt;<\/code><\/em>:<em class=\"replaceable\"><code>&lt;\/remote\/export&gt;<\/code><\/em><em class=\"replaceable\"><code>&lt;\/local\/directory&gt;<\/code><\/em><\/code>\r\n<\/pre>\n<p>Replace <em class=\"replaceable\"><code><span style=\"font-family: Courier New;\">&lt;nfs-type&gt;<\/span><\/code><\/em> with either <code class=\"command\"><span style=\"font-family: Courier New;\">nfs<\/span><\/code> for NFSv2 or NFSv3 servers, or <code class=\"command\"><span style=\"font-family: Courier New;\">nfs4<\/span><\/code> for NFSv4 servers. Replace <em class=\"replaceable\"><code><span style=\"font-family: Courier New;\">&lt;options&gt;<\/span><\/code><\/em> with a comma separated list of options for the NFS file system (refer to <a title=\"19.4.\u00a0Common NFS Mount Options\" href=\"https:\/\/www.centos.org\/docs\/5\/html\/5.1\/Deployment_Guide\/s1-nfs-client-config-options.html\"><u><span style=\"color: #0066cc;\">Section\u00a019.4, \u201cCommon NFS Mount Options\u201d<\/span><\/u><\/a> for details). Replace <em class=\"replaceable\"><code><span style=\"font-family: Courier New;\">&lt;host&gt;<\/span><\/code><\/em> with the remote host, <em class=\"replaceable\"><code><span style=\"font-family: Courier New;\">&lt;\/remote\/export&gt;<\/span><\/code><\/em> with the remote directory being mounted, and <em class=\"replaceable\"><code><span style=\"font-family: Courier New;\">&lt;\/local\/directory&gt;<\/span><\/code><\/em> with the local directory where the remote file system is to be mounted.<\/p>\n<p>Refer to the <code class=\"command\"><span style=\"font-family: Courier New;\">mount<\/span><\/code> man page for more details.<\/p>\n<p>If accessing an NFS share by manually issuing the <code class=\"command\"><span style=\"font-family: Courier New;\">mount<\/span><\/code> command, the file system must be remounted manually after the system is rebooted. Red Hat Enterprise Linux offers two methods for mounting remote file systems automatically at boot time: the <code class=\"filename\"><span style=\"font-family: Courier New;\">\/etc\/fstab<\/span><\/code> file or the <code class=\"command\"><span style=\"font-family: Courier New;\">autofs<\/span><\/code> service.<\/p>\n<h2><span style=\"text-decoration: underline;\">\/etc\/fstab Approach<\/span><\/h2>\n<p><a id=\"s2-nfs-fstab\"><\/a>19.2.1.\u00a0Mounting NFS File Systems using <code class=\"filename\">\/etc\/fstab<\/code><\/p>\n<p><a id=\"id2851075\" class=\"indexterm\"><\/a> <a id=\"id2851088\" class=\"indexterm\"><\/a> An alternate way to mount an NFS share from another machine is to add a line to the <code class=\"filename\">\/etc\/fstab<\/code> file. The line must state the hostname of the NFS server, the directory on the server being exported, and the directory on the local machine where the NFS share is to be mounted. You must be root to modify the <code class=\"filename\">\/etc\/fstab<\/code> file.<\/p>\n<p>The general syntax for the line in <code class=\"filename\">\/etc\/fstab<\/code> is as follows:<\/p>\n<pre class=\"screen\"><code class=\"computeroutput\">server:\/usr\/local\/pub \/pub nfs rsize=8192,wsize=8192,timeo=14,intr<\/code>\r\n<\/pre>\n<p>The mount point <code class=\"filename\">\/pub<\/code> must exist on the client machine before this command can be executed. After adding this line to <code class=\"filename\">\/etc\/fstab<\/code> on the client system, type the command <code class=\"filename\">mount \/pub<\/code> at a shell prompt, and the mount point <code class=\"filename\">\/pub<\/code> is mounted from the server.<\/p>\n<p>The <code class=\"filename\">\/etc\/fstab<\/code> file is referenced by the <code class=\"command\">netfs<\/code> service at boot time, so lines referencing NFS shares have the same effect as manually typing the <code class=\"command\">mount<\/code> command during the boot process.<\/p>\n<p>A sample <code class=\"filename\">\/etc\/fstab<\/code> line to mount an NFS export looks like the following example:<\/p>\n<pre class=\"screen\"><code class=\"command\"><em class=\"replaceable\"><code>&lt;server&gt;<\/code><\/em>:<em class=\"replaceable\"><code>&lt;\/remote\/export&gt;<\/code><\/em><em class=\"replaceable\"><code>&lt;\/local\/directory&gt;<\/code><\/em><em class=\"replaceable\"><code>&lt;nfs-type&gt;<\/code><\/em><em class=\"replaceable\"><code>&lt;options&gt;<\/code><\/em> 0 0<\/code>\r\n<\/pre>\n<p>Replace <code class=\"option\"><em class=\"replaceable\"><code>&lt;server&gt;<\/code><\/em><\/code> with the hostname, IP address, or fully qualified domain name of the server exporting the file system.<\/p>\n<p>Replace <code class=\"option\"><em class=\"replaceable\"><code>&lt;\/remote\/export&gt;<\/code><\/em><\/code> with the path to the exported directory.<\/p>\n<p>Replace <code class=\"option\"><em class=\"replaceable\"><code>&lt;\/local\/directory&gt;<\/code><\/em><\/code> with the local file system on which the exported directory is mounted. This mount point must exist before <code class=\"filename\">\/etc\/fstab<\/code> is read or the mount fails.<\/p>\n<p>Replace <code class=\"option\"><em class=\"replaceable\"><code>&lt;nfs-type&gt;<\/code><\/em><\/code> with either <code class=\"command\">nfs<\/code> for NFSv2 or NFSv3 servers, or <code class=\"command\">nfs4<\/code> for NFSv4 servers.<\/p>\n<p>Replace <em class=\"replaceable\"><code>&lt;options&gt;<\/code><\/em> with a comma separated list of options for the NFS file system (refer to <a title=\"19.4.\u00a0Common NFS Mount Options\" href=\"https:\/\/www.centos.org\/docs\/5\/html\/5.1\/Deployment_Guide\/s1-nfs-client-config-options.html\"><u><span style=\"color: #0066cc;\">Section\u00a019.4, \u201cCommon NFS Mount Options\u201d<\/span><\/u><\/a> for details). Refer to the <code class=\"filename\">fstab<\/code> man page for additional information.<\/p>\n<p>&nbsp;<\/p>\n<p>SOURCE:\u00a0 https:\/\/www.centos.org\/docs\/5\/html\/5.1\/Deployment_Guide\/s1-nfs-client-config-options.html<\/p>\n<p>More Info:<\/p>\n<p>http:\/\/www.pclosmag.com\/html\/Issues\/200709\/page07.html<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What a Linux hodge-podge&#8230; Command Line approach 19.2.\u00a0NFS Client Configuration NFS shares are mounted on the client side using the mount command. The format of the command is as follows: mount -t &lt;nfs-type&gt; -o &lt;options&gt;&lt;host&gt;:&lt;\/remote\/export&gt;&lt;\/local\/directory&gt; Replace &lt;nfs-type&gt; with either nfs for NFSv2 or NFSv3 servers, or nfs4 for NFSv4 servers. Replace &lt;options&gt; with a comma separated list of options for the NFS file system (refer to Section\u00a019.4, \u201cCommon NFS Mount Options\u201d for details). Replace &lt;host&gt; with the remote host, &lt;\/remote\/export&gt;&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.rickyadams.com\/wp\/mounting-nfs-volumes-in-linux-using-mount-or-etcfstab\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-303","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/posts\/303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/comments?post=303"}],"version-history":[{"count":2,"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/posts\/303\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/posts\/303\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/media?parent=303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/categories?post=303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rickyadams.com\/wp\/wp-json\/wp\/v2\/tags?post=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}