⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 network-nfs.html

📁 FreeBSD安装说明概述 FreeBSD 提供了一个以文字为主
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">portmap</kbd><samp class="PROMPT">#</samp> <kbd class="USERINPUT">nfsd -u -t -n 4</kbd><samp class="PROMPT">#</samp> <kbd class="USERINPUT">mountd -r</kbd></pre><p>On the <acronym class="ACRONYM">NFS</acronym> client:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">nfsiod -n 4</kbd></pre><p>Now everything should be ready to actually mount a remote file system. In theseexamples the server's name will be <var class="LITERAL">server</var> and the client'sname will be <var class="LITERAL">client</var>. If you only want to temporarily mount aremote filesystem or would rather test the configuration, just execute a command likethis as <tt class="USERNAME">root</tt> on the client:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">mount server:/home /mnt</kbd></pre><p>This will mount the <tt class="FILENAME">/home</tt> directory on the server at <ttclass="FILENAME">/mnt</tt> on the client. If everything is set up correctly you should beable to enter <tt class="FILENAME">/mnt</tt> on the client and see all the files that areon the server.</p><p>If you want to automatically mount a remote filesystem each time the computer boots,add the filesystem to the <tt class="FILENAME">/etc/fstab</tt> file. Here is anexample:</p><pre class="PROGRAMLISTING">server:/home   /mnt    nfs rw  0   0</pre><p>The <span class="CITEREFENTRY"><span class="REFENTRYTITLE">fstab</span>(5)</span>manual page lists all the available options.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN26295" name="AEN26295">19.6.3. Practical Uses</a></h2><p><acronym class="ACRONYM">NFS</acronym> has many practical uses. Some of the morecommon ones are listed below:</p><ul><li><p>Set several machines to share a CDROM or other media among them. This is cheaper andoften a more convenient method to install software on multiple machines.</p></li><li><p>On large networks, it might be more convenient to configure a central <acronymclass="ACRONYM">NFS</acronym> server in which to store all the user home directories.These home directories can then be exported to the network so that users would alwayshave the same home directory, regardless of which workstation they log in to.</p></li><li><p>Several machines could have a common <tt class="FILENAME">/usr/ports/distfiles</tt>directory. That way, when you need to install a port on several machines, you can quicklyaccess the source without downloading it on each machine.</p></li></ul></div><div class="SECT2"><h2 class="SECT2"><a id="NETWORK-AMD" name="NETWORK-AMD">19.6.4. Automatic Mounts with <bclass="APPLICATION">amd</b></a></h2><i class="AUTHORGROUP"><span class="CONTRIB">Contributed by</span> Wylie Stilwell.</i> <iclass="AUTHORGROUP"><span class="CONTRIB">Rewritten by</span> Chern Lee.</i> <p><span class="CITEREFENTRY"><span class="REFENTRYTITLE">amd</span>(8)</span> (theautomatic mounter daemon) automatically mounts a remote filesystem whenever a file ordirectory within that filesystem is accessed. Filesystems that are inactive for a periodof time will also be automatically unmounted by <b class="APPLICATION">amd</b>. Using <bclass="APPLICATION">amd</b> provides a simple alternative to permanent mounts, aspermanent mounts are usually listed in <tt class="FILENAME">/etc/fstab</tt>.</p><p><b class="APPLICATION">amd</b> operates by attaching itself as an NFS server to the<tt class="FILENAME">/host</tt> and <tt class="FILENAME">/net</tt> directories. When afile is accessed within one of these directories, <b class="APPLICATION">amd</b> looks upthe corresponding remote mount and automatically mounts it. <ttclass="FILENAME">/net</tt> is used to mount an exported filesystem from an IP address,while <tt class="FILENAME">/host</tt> is used to mount an export from a remotehostname.</p><p>An access to a file within <tt class="FILENAME">/host/foobar/usr</tt> would tell <bclass="APPLICATION">amd</b> to attempt to mount the <tt class="FILENAME">/usr</tt> exporton the host <tt class="HOSTID">foobar</tt>.</p><div class="EXAMPLE"><a id="AEN26348" name="AEN26348"></a><p><b>Example 19-1. Mounting an Export with amd</b></p><p>You can view the available mounts of a remote host with the <ttclass="COMMAND">showmount</tt> command. For example, to view the mounts of a host named<tt class="HOSTID">foobar</tt>, you can use:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">showmount -e foobar</kbd>Exports list on foobar:/usr                               10.10.10.0/a                                 10.10.10.0<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /host/foobar/usr</kbd></pre></div><p>As seen in the example, the <tt class="COMMAND">showmount</tt> shows <ttclass="FILENAME">/usr</tt> as an export. When changing directories to <ttclass="FILENAME">/host/foobar/usr</tt>, <b class="APPLICATION">amd</b> attempts toresolve the hostname <tt class="HOSTID">foobar</tt> and automatically mount the desiredexport.</p><p><b class="APPLICATION">amd</b> can be started by the startup scripts by placing thefollowing lines in <tt class="FILENAME">/etc/rc.conf</tt>:</p><pre class="PROGRAMLISTING">amd_enable="YES"</pre><p>Additionally, custom flags can be passed to <b class="APPLICATION">amd</b> from the<var class="VARNAME">amd_flags</var> option. By default, <varclass="VARNAME">amd_flags</var> is set to:</p><pre class="PROGRAMLISTING">amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"</pre><p>The <tt class="FILENAME">/etc/amd.map</tt> file defines the default options thatexports are mounted with. The <tt class="FILENAME">/etc/amd.conf</tt> file defines someof the more advanced features of <b class="APPLICATION">amd</b>.</p><p>Consult the <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">amd</span>(8)</span> and <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">amd.conf</span>(5)</span> manual pages for more information.</p></div><div class="SECT2"><h2 class="SECT2"><a id="NETWORK-NFS-INTEGRATION" name="NETWORK-NFS-INTEGRATION">19.6.5.Problems Integrating with Other Systems</a></h2><i class="AUTHORGROUP"><span class="CONTRIB">Contributed by</span> John Lind.</i> <p>Certain Ethernet adapters for ISA PC systems have limitations which can lead toserious network problems, particularly with NFS. This difficulty is not specific toFreeBSD, but FreeBSD systems are affected by it.</p><p>The problem nearly always occurs when (FreeBSD) PC systems are networked withhigh-performance workstations, such as those made by Silicon Graphics, Inc., and SunMicrosystems, Inc. The NFS mount will work fine, and some operations may succeed, butsuddenly the server will seem to become unresponsive to the client, even though requeststo and from other systems continue to be processed. This happens to the client system,whether the client is the FreeBSD system or the workstation. On many systems, there is noway to shut down the client gracefully once this problem has manifested itself. The onlysolution is often to reset the client, because the NFS situation cannot be resolved.</p><p>Though the ``correct'' solution is to get a higher performance and capacity Ethernetadapter for the FreeBSD system, there is a simple workaround that will allow satisfactoryoperation. If the FreeBSD system is the <span class="emphasis"><iclass="EMPHASIS">server</i></span>, include the option <var class="OPTION">-w=1024</var>on the mount from the client. If the FreeBSD system is the <span class="emphasis"><iclass="EMPHASIS">client</i></span>, then mount the NFS filesystem with the option <varclass="OPTION">-r=1024</var>. These options may be specified using the fourth field ofthe <tt class="FILENAME">fstab</tt> entry on the client for automatic mounts, or by usingthe <var class="OPTION">-o</var> parameter of the mount command for manual mounts.</p><p>It should be noted that there is a different problem, sometimes mistaken for this one,when the NFS servers and clients are on different networks. If that is the case, make<span class="emphasis"><i class="EMPHASIS">certain</i></span> that your routers arerouting the necessary UDP information, or you will not get anywhere, no matter what elseyou are doing.</p><p>In the following examples, <tt class="HOSTID">fastws</tt> is the host (interface) nameof a high-performance workstation, and <tt class="HOSTID">freebox</tt> is the host(interface) name of a FreeBSD system with a lower-performance Ethernet adapter. Also, <ttclass="FILENAME">/sharedfs</tt> will be the exported NFS filesystem (see <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">exports</span>(5)</span>), and <ttclass="FILENAME">/project</tt> will be the mount point on the client for the exportedfilesystem. In all cases, note that additional options, such as <varclass="OPTION">hard</var> or <var class="OPTION">soft</var> and <varclass="OPTION">bg</var> may be desirable in your application.</p><p>Examples for the FreeBSD system (<tt class="HOSTID">freebox</tt>) as the client in <ttclass="FILENAME">/etc/fstab</tt> on freebox:</p><pre class="PROGRAMLISTING">fastws:/sharedfs /project nfs rw,-r=1024 0 0</pre><p>As a manual mount command on <tt class="HOSTID">freebox</tt>:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">mount -t nfs -o -r=1024 fastws:/sharedfs /project</kbd></pre><p>Examples for the FreeBSD system as the server in <tt class="FILENAME">/etc/fstab</tt>on <tt class="HOSTID">fastws</tt>:</p><pre class="PROGRAMLISTING">freebox:/sharedfs /project nfs rw,-w=1024 0 0</pre><p>As a manual mount command on <tt class="HOSTID">fastws</tt>:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">mount -t nfs -o -w=1024 freebox:/sharedfs /project</kbd></pre><p>Nearly any 16-bit Ethernet adapter will allow operation without the above restrictionson the read or write size.</p><p>For anyone who cares, here is what happens when the failure occurs, which alsoexplains why it is unrecoverable. NFS typically works with a ``block'' size of 8&nbsp;k(though it may do fragments of smaller sizes). Since the maximum Ethernet packet isaround 1500&nbsp;bytes, the NFS ``block'' gets split into multiple Ethernet packets, eventhough it is still a single unit to the upper-level code, and must be received,assembled, and <span class="emphasis"><i class="EMPHASIS">acknowledged</i></span> as aunit. The high-performance workstations can pump out the packets which comprise the NFSunit one right after the other, just as close together as the standard allows. On thesmaller, lower capacity cards, the later packets overrun the earlier packets of the sameunit before they can be transferred to the host and the unit as a whole cannot bereconstructed or acknowledged. As a result, the workstation will time out and try again,but it will try again with the entire 8&nbsp;K unit, and the process will be repeated, adinfinitum.</p><p>By keeping the unit size below the Ethernet packet size limitation, we ensure that anycomplete Ethernet packet received can be acknowledged individually, avoiding the deadlocksituation.</p><p>Overruns may still occur when a high-performance workstations is slamming data out toa PC system, but with the better cards, such overruns are not guaranteed on NFS``units''. When an overrun occurs, the units affected will be retransmitted, and therewill be a fair chance that they will be received, assembled, and acknowledged.</p></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="network-bridging.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="network-diskless.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Bridging</td><td width="34%" align="center" valign="top"><a href="advanced-networking.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Diskless Operation</td></tr></table></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -