{"id":309,"date":"2020-08-18T19:23:47","date_gmt":"2020-08-18T20:23:47","guid":{"rendered":"http:\/\/www.linux-tutorial.info\/?page_id=77"},"modified":"2020-08-22T19:26:39","modified_gmt":"2020-08-22T20:26:39","slug":"this-is-the-page-title-toplevel-144","status":"publish","type":"page","link":"http:\/\/www.linux-tutorial.info\/?page_id=309","title":{"rendered":"The Flow of Things"},"content":{"rendered":"\n<title>The Flow of Things<\/title>\n<p>\nThere are two <glossary>daemon<\/glossary> processes that provide the <glossary>NFS<\/glossary>\nservices on the server. These are mountd and\nnfsd. <command>Mountd<\/command> is responsible for checking access <glossary>permissions<\/glossary>\nto the exported <glossary>filesystem<\/glossary>. When a\nclients tries to <glossary>mount<\/glossary>\na <glossary>filesystem<\/glossary>, <command>mountd<\/command> returns a pointer to the filesystem if the <glossary>client<\/glossary>\nhas permission to <glossary>mount<\/glossary> it.\n<\/p>\n<p>\nThe workhorse on the server side is the nfsd <glossary>daemon<\/glossary>. It has the\nresponsibility of handling all <glossary>filesystem<\/glossary>\nrequests from the clients. Once a filesystem has been\nmounted, all access to the data on that remote <glossary>filesystem<\/glossary>\nis made through nfsd. Remember that you\ncould be exporting directories and not just entire filesystems. Therefore it&#8217;s better to say that\naccess to the <em>mount point<\/em> and below is made through nfsd.\n<\/p>\n<p>\nAlso key to this whole process is the portmapper, portmap. The portmapper converts TCP\/IP\nport numbers to <glossary>RPC<\/glossary> program numbers. What this means is that when\nthe <glossary>NFS<\/glossary> starts up, it registers its port with the local\nportmap process. The clients access the server by asking the portmapper on the server for the port\nnumber of nfsd and mountd. The port number is then used on all subsequent  <glossary>RPC<\/glossary>\ncalls.\n<\/p>\n<p>\nIn principle, mounting a remote <glossary>filesystem<\/glossary>\nis like mounting a local one. The general syntax\nis:<\/p>\n<p>\n<commandexample command=\"mount\">mount &lt;options&gt; &lt;filesystem&gt; &lt;mountpoint&gt; <\/commandexample>\n<\/p>\n<p>\nOne of the primary\ndifferences is that since we are an <glossary>NFS<\/glossary>\n<glossary>filesystem<\/glossary>,\nwe have to explicitly tell <glossary>mount<\/glossary>, by using the\n&#8216;-t nfs option. We can also include other options such as &#8216;-r&#8217; for read only. Let&#8217;s assume that we\nhave our two machines jmohr and siemau. On siemau is an <glossary>NFS<\/glossary>\n<glossary>filesystem<\/glossary>\nthat we want to <glossary>mount<\/glossary>\nfrom\njmohr. Assuming that the proper entries exist in the \/etc\/exports file on siemau, the command on\njmohr might look like this:<\/p>\n<p>\n<commandexample command=\"mount\">mount -t nfs junior:\/usr\/data \/data<\/commandexample>\n<\/p>\n<p>\nLike other filesystems, the local <glossary>mount<\/glossary>\ncommand parses the command into tokens and ensures that entries don&#8217;t already exist\nin the <glossary>mount<\/glossary> table (<file type=\"\">\/etc\/mnttab<\/file>) for either the <glossary>filesystem<\/glossary>\nor the directory. Realizing that this is a remote <glossary>filesystem<\/glossary>,\n<glossary>mount<\/glossary> gets the <glossary>IP<\/glossary> <glossary>address<\/glossary>\nfor siemau (by whatever means are configured on the\nlocal machine) and gets the port number of mountd on siemau. The <glossary>mount<\/glossary>\ncommand then passes <file type=\"\">mountd<\/file> the pathname of the requested directory\n(<directory>\/usr\/data<\/directory>).\n<\/p>\n<p>\nNow it&#8217;s the server&#8217;s turn. To makes sure it can service the request, mountd must first\ncheck <file type=\"\">\/etc\/exports<\/file> for the requested <glossary>filesystem<\/glossary>.\nIn this case <directory>\/usr\/data<\/directory>.\nIf jmohr is permitted, mountd passes back what is called a file handle, or\npointer. Now the <glossary>mount<\/glossary>\nback on jmohr uses that file handle and the <glossary>mount point<\/glossary>\n(<directory>\/data<\/directory>) as arguments the mount() <glossary>system call<\/glossary>.\n Finally, an entry is placed in the local <glossary>mount<\/glossary> table.\n<\/p>\n<p>\nThere are two\nprimary <glossary>NFS<\/glossary>\nconfiguration files: <file type=\"\">\/etc\/exports<\/file> and <file type=\"\">\/etc\/fstab<\/file>.\nThe <file type=\"\">\/etc\/exports<\/file> file exists on the\nserver and list those files and directories that can be accessed by remote hosts. It can also be\nconfigured to allow or deny access to specific hosts. Since each of these is a\n<glossary>filesystem<\/glossary>, you can manage\nanything mounted by <glossary>NFS<\/glossary>\nthrough \/etc\/fstab. This allows you to <glossary>mount<\/glossary>\nremote filesystems at <glossary>boot<\/glossary>\nor\nin any way you can with a &#8220;normal&#8221; <glossary>filesystem<\/glossary>.\n One advantage <glossary>NFS<\/glossary>\nhas over local filesystems is that\nyou can configure them to be mounted only when you need them. That is, if the files in the\ndirectories are not used, the connection is not made. However, if the files are needed, the\nconnection is automatically made. This is the concept of automounting, which we will get into\nnext.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Flow of Things There are two daemon processes that provide the NFS services on the server. These are mountd and nfsd. Mountd is responsible for checking access permissions to the exported filesystem. When a clients tries to mount a &hellip; <a href=\"http:\/\/www.linux-tutorial.info\/?page_id=309\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-309","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=309"}],"version-history":[{"count":1,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/309\/revisions"}],"predecessor-version":[{"id":746,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/309\/revisions\/746"}],"wp:attachment":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}