From owner-freebsd-doc Tue Feb 19 19:50:41 2002 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 7029537B417 for ; Tue, 19 Feb 2002 19:50:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g1K3o2D95303; Tue, 19 Feb 2002 19:50:02 -0800 (PST) (envelope-from gnats) Date: Tue, 19 Feb 2002 19:50:02 -0800 (PST) Message-Id: <200202200350.g1K3o2D95303@freefall.freebsd.org> To: freebsd-doc@freebsd.org Cc: From: Tom Rhodes Subject: Re: docs/35098: [PATCH] Handbook NFS stuff Reply-To: Tom Rhodes Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR docs/35098; it has been noted by GNATS. From: Tom Rhodes 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 @@ + Tom + Rhodes + Reorganized and enhanced by + + + + Bill Swingle Written by @@ -658,44 +665,42 @@ NFS 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. + the Network File System also known as NFS. + NFS allows your system to share directories and files on + with others over the network. By using NFS, users and + programs can access files on remote systems almost as if they were local files. - NFS has several benefits: + Some of the benefits for using NFS are: - Local workstations do not need as much disk space because + 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. + remain accessible to others over the network. - 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. + 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 NFS filesystem, + it can be accessed from anywhere on the network. - Storage devices such as floppies and CDROM drives can be - used by other machines on the network eliminating the need for - extra hardware. + 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. - How It Works + How <acronym>NFS</acronym> Works - NFS is composed of two sides – a client side and a - server side. Think of it as a want/have relationship. The client - wants the data that the server side - has. 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. + NFS 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: The server has to be running the following daemons: @@ -723,85 +728,73 @@ nfsd - The NFS Daemon which services requests from NFS - clients. + The NFS daemon which serves requests from + the NFS clients. mountd - The NFS Mount Daemon which actually carries out + The NFS mount daemon which actually carries out requests that &man.nfsd.8; passes on to it. portmap - The portmapper daemon which - allows NFS clients to find out which port the NFS server - is using. + The portmapper daemon + allows NFS clients to find out which port the + NFS server is using. - The client side only needs to run a single daemon: - - NFS - client - - - nfsiod - - - - - - - nfsiod - The NFS async I/O Daemon which services requests - from its NFS server. - - - - + The client can also run a daemon, known as + nfsiod. The nfsiod + daemon services the requests from a NFS 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. + - Configuring NFS + Configuring <acronym>NFS</acronym> NFS configuration - 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 + On FreeBSD, the setup of NFS 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 /etc/rc.conf file. - On the NFS server make sure you have: + On the NFS server, make sure that the following options + in the /etc/rc.conf file: portmap_enable="YES" nfs_server_enable="YES" nfs_server_flags="-u -t -n 4" mountd_flags="-r" - mountd is automatically run whenever the - NFS server is enabled. The and - flags to nfsd tell it to + mountd runs automatically whenever the + NFS server is enabled. The and + flags tell nfsd to serve UDP and TCP clients. The flag tells nfsd to start 4 copies of itself. - On the client, make sure you have: + On the client, make sure these options are present in the + /etc/rc.conf file: nfs_client_enable="YES" nfs_client_flags="-n 4" - Like nfsd, the tells + Like with nfsd, the tells nfsiod to start 4 copies of itself. - The last configuration step requires that you create a file - called /etc/exports. The exports file - specifies which file systems on your server will be shared - (a.k.a., exported) 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 + The NFS configuration requires that a file + called /etc/exports exsists. The exports file + specifies which file systems on your server will be exported + or shared 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. @@ -810,54 +803,57 @@ NFS - exporting filesystems + examples of exporting filesystems - The following line exports /cdrom to - three silly machines that have the same domain name as the server + 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 /cdrom 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 /etc/hosts file. The - 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. + 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. - /cdrom -ro moe larry curly + /cdrom -ro example1 example2 example3 The following line exports /home to three hosts by IP address. This is a useful setup if you have a - private network but do not have DNS running. The - flag allows all the directories below + private network but do not have a DNS server configured. The + flag allows for all of the directories below the specified file system to be exported as well. /home -alldirs 10.0.0.2 10.0.0.3 10.0.0.4 - The following line exports /a to two - machines that have different domain names than the server. The - 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. + The following line exports /a so that two + machines with different domain names may access the server. The + flag allows the root + user on the remote system to write data on the exported 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 exported file system. - /a -maproot=0 host.domain.com box.example.com + /a -maproot=0 host.example.com box.example2.com - 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 + 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 /etc/exports file. - In /etc/exports, each line represents + In the /etc/exports 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 /usr is a single filesystem. The - following /etc/exports is invalid: + following /etc/exports would be invalid: /usr/src client /usr/ports client One filesystem, /usr, has two lines - specifying its exports to the same host, - client. The correct format is: + specifying its exports to the same host, client. + The correct format for this situation is: /usr/src /usr/ports client @@ -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 - You must restart - mountd whenever you modify - /etc/exports to make changes take - effect. This can be accomplished by sending the hangup signal + You must restart mountd whenever you modify + /etc/exports to make the changes current. + This can be accomplished by either sending the hangup signal to the mountd process: &prompt.root; kill -HUP `cat /var/run/mountd.pid` - 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: + Or, a simple reboot should make FreeBSD set everything up + for you. Although, a reboot is not nessissary + the following commands, run as root of course, + could start everything up also. - On the NFS server: + On the NFS server: &prompt.root; portmap &prompt.root; nfsd -u -t -n 4 &prompt.root; mountd -r - On the NFS client: + On the NFS client: &prompt.root; nfsiod -n 4 - Now you should be ready to actually mount a remote file + 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 server and the client's name will be client. 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 root on the client: NFS @@ -916,56 +912,56 @@ This will mount the /home directory on the server at /mnt 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 + /mnt on the client and see all the files that are on the server. If you want to automatically mount a remote file system - each time the computer boots, add the filesystem to - /etc/fstab. Here is an example: + each time the computer boots, add the filesystem to the + /etc/fstab file. Here is an example: server:/home /mnt nfs rw 0 0 - Read the &man.fstab.5; manual page for more options. + The &man.fstab.5; manual page will show many more options that are available. Practical Uses - There are many very cool uses for NFS. Some of the more common - ones are listed below. + There are many practical uses for NFS. Some of the + more common ones are listed below: + + The following practicle NFS examples require + the proper NFS configuration before actual use. + + NFS uses - Have several machines on a network and share a CDROM or - floppy drive among them. This is cheaper and often more - convenient. + Setup several machines on a network to share a CDROM or + floppy drive among them. This is cheaper and often more convenient. - 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. + With so many machines on a network, you can have a + central NFS 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. - 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! + You can use one CDROM on the NFS server to install + FreeBSD over the network on multiple machines. - Have a common /usr/ports/distfiles - 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! + Several machines could have a common /usr/ports/distfiles + directory. That way, when you install a port on several machines, you can + quickly access the source without downloading it on each machine. @@ -992,14 +988,14 @@ amd automatic mounter daemon - &man.amd.8;, which is also known as the automatic mounter + &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 amd. Using amd provides a simplistic alternative - to static mounts. + to perminant mounts. amd operates by attaching itself as an NFS server to the /host and To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message