Date: Tue, 19 Feb 2002 19:50:02 -0800 (PST) From: Tom Rhodes <darklogik@pittgoth.com> To: freebsd-doc@freebsd.org Subject: Re: docs/35098: [PATCH] Handbook NFS stuff Message-ID: <200202200350.g1K3o2D95303@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR docs/35098; it has been noted by GNATS. From: Tom Rhodes <darklogik@pittgoth.com> To: FreeBSD-gnats-submit@Freebsd.org Cc: Subject: Re: docs/35098: [PATCH] Handbook NFS stuff Date: Tue, 19 Feb 2002 22:49:29 -0500 (EST) Please review this, it has alot of your ideas, but a few of my own tossed in here. I did cover more ground than listed, and have yet to touch the amd part, well, more than the first paragraph hehe -- Tom (darklogik) Rhodes diff -ru handbook.old/advanced-networking/chapter.sgml handbook/advanced-networking/chapter.sgml --- handbook.old/advanced-networking/chapter.sgml Tue Feb 19 16:19:33 2002 +++ handbook/advanced-networking/chapter.sgml Tue Feb 19 22:42:26 2002 @@ -648,6 +648,13 @@ <sect1info> <authorgroup> <author> + <firstname>Tom</firstname> + <surname>Rhodes</surname> + <contrib>Reorganized and enhanced by </contrib> + </author> + </authorgroup> + <authorgroup> + <author> <firstname>Bill</firstname> <surname>Swingle</surname> <contrib>Written by </contrib> @@ -658,44 +665,42 @@ <indexterm><primary>NFS</primary></indexterm> <para>Among the many different file systems that FreeBSD supports is - the Network File System or NFS. NFS allows you - to share directories and files on one machine with others - via the network they are attached to. Using NFS, users and - programs can access files on remote systems as if they were local - files.</para> + the Network File System also known as <acronym>NFS</acronym>. + <acronym>NFS</acronym> allows your system to share directories and files on + with others over the network. By using <acronym>NFS</acronym>, users and + programs can access files on remote systems almost as if they were local files.</para> - <para>NFS has several benefits:</para> + <para>Some of the benefits for using <acronym>NFS</acronym> are:</para> <itemizedlist> <listitem> - <para>Local workstations do not need as much disk space because + <para>Local workstations use less disk space because commonly used data can be stored on a single machine and still - remain accessible to everyone on the network.</para> + remain accessible to others over the network.</para> </listitem> <listitem> - <para>There is no need for users to have unique home directories - on every machine on your network. Once they have an established - directory that is available via NFS it can be accessed from - anywhere.</para> + <para>There would be no need for users to have unique home directories + on every network machine. Once they have an established a home + directory that is available on an <acronym>NFS</acronym> filesystem, + it can be accessed from anywhere on the network.</para> </listitem> <listitem> - <para>Storage devices such as floppies and CDROM drives can be - used by other machines on the network eliminating the need for - extra hardware.</para> + <para>Storage devices such as floppy disks, CDROM drives, and ZIP drives + can be used by other machines on the network. This may elimininate the + need for every system to have a CDROM or ZIP drive, providing a more + cost effective solution.</para> </listitem> </itemizedlist> <sect2> - <title>How It Works</title> + <title>How <acronym>NFS</acronym> Works</title> - <para>NFS is composed of two sides – a client side and a - server side. Think of it as a want/have relationship. The client - <emphasis>wants</emphasis> the data that the server side - <emphasis>has</emphasis>. The server shares its data with the - client. In order for this system to function properly a few - processes have to be configured and running.</para> + <para><acronym>NFS</acronym> consists of at least two parts; a client and + a server. The client remotely accesses the data that is stored locally + on the server machine. In order for this to function properly a few + processes have to be configured and running:</para> <para>The server has to be running the following daemons:</para> <indexterm> @@ -723,85 +728,73 @@ <tbody> <row> <entry>nfsd</entry> - <entry>The NFS Daemon which services requests from NFS - clients.</entry> + <entry>The <acronym>NFS</acronym> daemon which serves requests from + the <acronym>NFS</acronym> clients.</entry> </row> <row> <entry>mountd</entry> - <entry>The NFS Mount Daemon which actually carries out + <entry>The <acronym>NFS</acronym> mount daemon which actually carries out requests that &man.nfsd.8; passes on to it.</entry> </row> <row> <entry>portmap</entry> - <entry> The <command>portmapper</command> daemon which - allows NFS clients to find out which port the NFS server - is using.</entry> + <entry> The <command>portmapper</command> daemon + allows <acronym>NFS</acronym> clients to find out which port the + <acronym>NFS</acronym> server is using.</entry> </row> </tbody> </tgroup> </informaltable> - <para>The client side only needs to run a single daemon:</para> - <indexterm> - <primary>NFS</primary> - <secondary>client</secondary> - </indexterm> - <indexterm> - <primary><application>nfsiod</application></primary> - </indexterm> - - <informaltable frame="none"> - <tgroup cols="2"> - <tbody> - <row> - <entry>nfsiod</entry> - <entry>The NFS async I/O Daemon which services requests - from its NFS server.</entry> - </row> - </tbody> - </tgroup> - </informaltable> + <para>The client can also run a daemon, known as + <application>nfsiod</application>. The <application>nfsiod</application> + daemon services the requests from a <acronym>NFS</acronym> server. This, + is optional, and improves performance, but not really required for normal + and correct operation. See the &man.nfsiod.8; man page for more information. + </para> </sect2> <sect2 id="configuring-nfs"> - <title>Configuring NFS</title> + <title>Configuring <acronym>NFS</acronym></title> <indexterm> <primary>NFS</primary> <secondary>configuration</secondary> </indexterm> - <para>Luckily for us, on a FreeBSD system this setup is a snap. The - processes that need to be running can all be run at boot time with + <para>On FreeBSD, the setup of <acronym>NFS</acronym> is a relatively straightforward + process. The processes that need to be running can all be run at boot time with a few modifications to your <filename>/etc/rc.conf</filename> file.</para> - <para>On the NFS server make sure you have:</para> + <para>On the <acronym>NFS</acronym> server, make sure that the following options + in the <filename>/etc/rc.conf</filename> file:</para> <programlisting>portmap_enable="YES" nfs_server_enable="YES" nfs_server_flags="-u -t -n 4" mountd_flags="-r"</programlisting> - <para><command>mountd</command> is automatically run whenever the - NFS server is enabled. The <option>-u</option> and - <option>-t</option> flags to <command>nfsd</command> tell it to + <para><command>mountd</command> runs automatically whenever the + <acronym>NFS</acronym> server is enabled. The <option>-u</option> and + <option>-t</option> flags tell <command>nfsd</command> to serve UDP and TCP clients. The <option>-n 4</option> flag tells <command>nfsd</command> to start 4 copies of itself.</para> - <para>On the client, make sure you have:</para> + <para>On the client, make sure these options are present in the + <filename>/etc/rc.conf</filename> file:</para> <programlisting>nfs_client_enable="YES" nfs_client_flags="-n 4"</programlisting> - <para>Like <command>nfsd</command>, the <option>-n 4</option> tells + <para>Like with <command>nfsd</command>, the <option>-n 4</option> tells <command>nfsiod</command> to start 4 copies of itself.</para> - <para>The last configuration step requires that you create a file - called <filename>/etc/exports</filename>. The exports file - specifies which file systems on your server will be shared - (a.k.a., <quote>exported</quote>) and with what clients they will - be shared. Each line in the file specifies a file system to be - shared. There are a handful of options that can be used in this + <para>The <acronym>NFS</acronym> configuration requires that a file + called <filename>/etc/exports</filename> exsists. The exports file + specifies which file systems on your server will be exported + or <quote>shared</quote> and with what clients they will + exported too. Each line in the file specifies a file system to be + exported. There are many options that can be used in this file but only a few will be mentioned here. You can find out about the rest in the &man.exports.5; manual page.</para> @@ -810,54 +803,57 @@ <indexterm> <primary>NFS</primary> - <secondary>exporting filesystems</secondary> + <secondary>examples of exporting filesystems</secondary> </indexterm> - <para>The following line exports <filename>/cdrom</filename> to - three silly machines that have the same domain name as the server + <para>In the following examples, an idea of how to export filesystems + is displayed, although the settings may be different depending on + environment and network setup. + The following line exports <filename>/cdrom</filename> to + three example machines that have the same domain name as the server (hence the lack of a domain name for each) or have entries in your <filename>/etc/hosts</filename> file. The <option>-ro</option> - flag makes the shared file system read-only. With this flag, the - remote system will not be able to make any changes to the - shared file system.</para> + flag makes the exported file system read-only. With this flag, the + remote system will not be able to write any changes to the + exported file system.</para> - <programlisting>/cdrom -ro moe larry curly</programlisting> + <programlisting>/cdrom -ro example1 example2 example3</programlisting> <para>The following line exports <filename>/home</filename> to three hosts by IP address. This is a useful setup if you have a - private network but do not have DNS running. The - <option>-alldirs</option> flag allows all the directories below + private network but do not have a <acronym>DNS</acronym> server configured. The + <option>-alldirs</option> flag allows for all of the directories below the specified file system to be exported as well.</para> <programlisting>/home -alldirs 10.0.0.2 10.0.0.3 10.0.0.4</programlisting> - <para>The following line exports <filename>/a</filename> to two - machines that have different domain names than the server. The - <option>-maproot=0</option> flag allows - the root user on the remote system to write to the shared - file system as root. Without the -maproot=0 flag even if - someone has root access on the remote system they will not - be able to modify files on the shared file system.</para> + <para>The following line exports <filename>/a</filename> so that two + machines with different domain names may access the server. The + <option>-maproot=0</option> flag allows the <username>root</username> + user on the remote system to write data on the exported file system as + <username>root</username>. Without the -maproot=0 flag, even if + someone has <username>root</username> access on the remote system they will not + be able to modify files on the exported file system.</para> - <programlisting>/a -maproot=0 host.domain.com box.example.com</programlisting> + <programlisting>/a -maproot=0 host.example.com box.example2.com</programlisting> - <para>In order for a client to access- an exported file system it must - have permission to do so. Make sure your client is listed in your + <para>In order for a client to access an exported file system, the client must + have permission to do so. Make sure the client is listed in your <filename>/etc/exports</filename> file.</para> - <para>In <filename>/etc/exports</filename>, each line represents + <para>In the <filename>/etc/exports</filename> file, each line represents the export information for one filesystem to one host. A - remote host can only be specified once for each local - filesystem, and you can only have one default entry per local + remote host can only be specified once per + filesystem, and may only have one default entry for each filesystem. For example, let's assume that <filename>/usr</filename> is a single filesystem. The - following <filename>/etc/exports</filename> is invalid:</para> + following <filename>/etc/exports</filename> would be invalid:</para> <programlisting>/usr/src client /usr/ports client</programlisting> <para>One filesystem, <filename>/usr</filename>, has two lines - specifying its exports to the same host, - <hostid>client</hostid>. The correct format is:</para> + specifying its exports to the same host, <hostid>client</hostid>. + The correct format for this situation is:</para> <programlisting>/usr/src /usr/ports client</programlisting> @@ -874,39 +870,39 @@ # client01 has root privileges on it /usr/src /usr/ports -maproot=0 client01 /usr/src /usr/ports client02 -# The "client" machines have root and can mount anywhere -# up /exports. Anyone inhe world can mount /exports/obj read-only +# The client machines have root and can mount anywhere +# on /exports. Anyone in the world can mount /exports/obj read-only /exports -alldirs -maproot=0 client01 client02 /exports/obj -ro</programlisting> - <para>You must restart - <command>mountd</command> whenever you modify - <filename>/etc/exports</filename> to make changes take - effect. This can be accomplished by sending the hangup signal + <para>You must restart <command>mountd</command> whenever you modify + <filename>/etc/exports</filename> to make the changes current. + This can be accomplished by either sending the hangup signal to the <command>mountd</command> process:</para> <screen>&prompt.root; <userinput>kill -HUP `cat /var/run/mountd.pid`</userinput></screen> - <para>Now that you have made all these changes you can just reboot - and let FreeBSD start everything for you at boot time, or you can - run the following commands as root:</para> + <para>Or, a simple reboot should make FreeBSD set everything up + for you. Although, a reboot is not nessissary + the following commands, run as <username>root</username> of course, + could start everything up also.</para> - <para>On the NFS server:</para> + <para>On the <acronym>NFS</acronym> server:</para> <screen>&prompt.root; <userinput>portmap</userinput> &prompt.root; <userinput>nfsd -u -t -n 4</userinput> &prompt.root; <userinput>mountd -r</userinput></screen> - <para>On the NFS client:</para> + <para>On the <acronym>NFS</acronym> client:</para> <screen>&prompt.root; <userinput>nfsiod -n 4</userinput></screen> - <para>Now you should be ready to actually mount a remote file + <para>Now everything should be ready to actually mount a remote file system. This can be done one of two ways. In these examples the server's name will be <literal>server</literal> and the client's name will be <literal>client</literal>. If you just want to - temporarily mount a remote file system or just want to test out - your configuration you can run a command like this as root on the + temporarily mount a remote file system or just want to test the + configuration, just run a command like this as <username>root</username> on the client:</para> <indexterm> <primary>NFS</primary> @@ -916,56 +912,56 @@ <para>This will mount the <filename>/home</filename> directory on the server at <filename>/mnt</filename> on the client. If - everything is setup correctly you should be able to go into - /mnt on the client and see all the files that are on the + everything is setup correctly you should be able to enter + <filename>/mnt</filename> on the client and see all the files that are on the server.</para> <para>If you want to automatically mount a remote file system - each time the computer boots, add the filesystem to - <filename>/etc/fstab</filename>. Here is an example:</para> + each time the computer boots, add the filesystem to the + <filename>/etc/fstab</filename> file. Here is an example:</para> <programlisting>server:/home /mnt nfs rw 0 0</programlisting> - <para>Read the &man.fstab.5; manual page for more options.</para> + <para>The &man.fstab.5; manual page will show many more options that are available.</para> </sect2> <sect2> <title>Practical Uses</title> - <para>There are many very cool uses for NFS. Some of the more common - ones are listed below.</para> + <para>There are many practical uses for <acronym>NFS</acronym>. Some of the + more common ones are listed below:</para> + + <note><para>The following practicle <acronym>NFS</acronym> examples require + the proper <acronym>NFS</acronym> configuration before actual use.</para> + </note> + <indexterm> <primary>NFS</primary> <secondary>uses</secondary> </indexterm> <itemizedlist> <listitem> - <para>Have several machines on a network and share a CDROM or - floppy drive among them. This is cheaper and often more - convenient.</para> + <para>Setup several machines on a network to share a CDROM or + floppy drive among them. This is cheaper and often more convenient.</para> </listitem> <listitem> - <para>With so many machines on a network, it gets old having your - personal files strewn all over the place. You can have a - central NFS server that houses all user home directories and - shares them with the rest of the machines on the LAN, so no - matter where you log in you will have the same home - directory.</para> + <para>With so many machines on a network, you can have a + central <acronym>NFS</acronym> server store the user home directories and + export them with the rest of the machines on the network, this way + users can have the same home directory, regardless of which workstation + they log in to.</para> </listitem> <listitem> - <para>When you get to reinstalling FreeBSD on one of your - machines, NFS is the way to go! Just pop your distribution - CDROM into your file server and away you go!</para> + <para>You can use one CDROM on the <acronym>NFS</acronym> server to install + FreeBSD over the network on multiple machines.</para> </listitem> <listitem> - <para>Have a common <filename>/usr/ports/distfiles</filename> - directory that all your machines share. That way, when you go - to install a port that you have already installed on a different - machine, you do not have to download the source all over - again!</para> + <para>Several machines could have a common <filename>/usr/ports/distfiles</filename> + directory. That way, when you install a port on several machines, you can + quickly access the source without downloading it on each machine.</para> </listitem> </itemizedlist> </sect2> @@ -992,14 +988,14 @@ <indexterm><primary>amd</primary></indexterm> <indexterm><primary>automatic mounter daemon</primary></indexterm> - <para>&man.amd.8;, which is also known as the automatic mounter + <para>&man.amd.8;, also known as the automatic mounter daemon, is a useful utility used for automatically mounting a remote filesystem whenever a file or directory within that filesystem is accessed. Filesystems that are inactive for a period of time will also be automatically unmounted by <application>amd</application>. Using <application>amd</application> provides a simplistic alternative - to static mounts.</para> + to perminant mounts.</para> <para><application>amd</application> operates by attaching itself as an NFS server to the <filename>/host</filename> and To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202200350.g1K3o2D95303>