View | Details | Raw Unified | Return to bug 181269
Collapse All | Expand All

(-)en_US.ISO8859-1/books/handbook/network-servers/chapter.xml (-217 / +232 lines)
Lines 557-593 Link Here
557
    <title>Network File System (NFS)</title>
557
    <title>Network File System (NFS)</title>
558
558
559
    <indexterm><primary>NFS</primary></indexterm>
559
    <indexterm><primary>NFS</primary></indexterm>
560
    <para>Among the many different file systems that FreeBSD supports
560
    <para>&os; supports the Network File System
561
      is the Network File System, also known as <acronym role="Network
561
      (<acronym role="Network File System">NFS</acronym>).
562
      File System">NFS</acronym>.  <acronym role="Network File
562
      <acronym role="Network File System">NFS</acronym>
563
      System">NFS</acronym> allows a system to share directories and
563
      allows a server to share directories and
564
      files with others over a network.  By using <acronym
564
      files with clients over a network.  By using
565
      role="Network File System">NFS</acronym>, users and programs can
565
      <acronym role="Network File System">NFS</acronym>,
566
      access files on remote systems almost as if they were local
566
      users and programs can access files on remote systems
567
      files.</para>
567
      as if they were stored locally.</para>
568
568
569
    <para>Some of the most notable benefits that
569
    <para>The most notable benefits that
570
      <acronym>NFS</acronym> can provide are:</para>
570
      <acronym>NFS</acronym> provides are:</para>
571
571
572
    <itemizedlist>
572
    <itemizedlist>
573
      <listitem>
573
      <listitem>
574
	<para>Local workstations use less disk space because commonly
574
	<para>Data that would otherwise be duplicated on each
575
	  used data can be stored on a single machine and still remain
575
	  client can be kept in single location and accessed 
576
	  accessible to others over the network.</para>
576
	  by clients on the network.</para>
577
      </listitem>
577
      </listitem>
578
578
579
      <listitem>
579
      <listitem>
580
	<para>There is no need for users to have separate home
580
	<para>Users home directories can be stored in one location
581
	  directories on every network machine.  Home directories
581
	  and accessed by their owners over the network.  This also
582
	  could be set up on the <acronym>NFS</acronym> server and
582
	  has the benefit of simplified administration.  For example,
583
	  made available throughout the network.</para>
583
	  backing up one location instead of several, security
584
	  policies on one file system, etc.</para>
584
      </listitem>
585
      </listitem>
585
586
586
      <listitem>
587
      <listitem>
587
	<para>Storage devices such as floppy disks, CDROM drives, and
588
	<para>Storage devices such as floppy disks or
588
	  &iomegazip; drives can be used by other machines on the
589
	  <acronym>CD/DVD-ROM</acronym> drives can be used
589
	  network.  This may reduce the number of removable media
590
	  by other machines on the network.  This would reduce
590
	  drives throughout the network.</para>
591
	  the number of removable media drives throughout
592
	  the network and provide a centralized location to
593
	  manage the usage and security of such devices.</para>
591
      </listitem>
594
      </listitem>
592
    </itemizedlist>
595
    </itemizedlist>
593
596
Lines 600-606 Link Here
600
	order for this to function properly a few processes have to be
603
	order for this to function properly a few processes have to be
601
	configured and running.</para>
604
	configured and running.</para>
602
605
603
      <para>The server has to be running the following daemons:</para>
606
      <para>The server must be running the following daemons:</para>
604
      <indexterm>
607
      <indexterm>
605
	<primary>NFS</primary>
608
	<primary>NFS</primary>
606
	<secondary>server</secondary>
609
	<secondary>server</secondary>
Lines 661-668 Link Here
661
	<application>nfsiod</application>.  The
664
	<application>nfsiod</application>.  The
662
	<application>nfsiod</application> daemon services the requests
665
	<application>nfsiod</application> daemon services the requests
663
	from the <acronym>NFS</acronym> server.  This is optional, and
666
	from the <acronym>NFS</acronym> server.  This is optional, and
664
	improves performance, but is not required for normal and
667
	improves performance but is not required for normal
665
	correct operation.  See the &man.nfsiod.8; manual page for
668
	operation.  See the &man.nfsiod.8; manual page for
666
	more information.</para>
669
	more information.</para>
667
    </sect2>
670
    </sect2>
668
671
Lines 674-688 Link Here
674
	<secondary>configuration</secondary>
677
	<secondary>configuration</secondary>
675
      </indexterm>
678
      </indexterm>
676
679
677
      <para><acronym>NFS</acronym> configuration is a relatively
680
      <para>Enabling the <acronym>NFS</acronym> server
678
	straightforward process.  The processes that need to be
681
	is straightforward.  The processes that need
679
	running can all start at boot time with a few modifications
682
	to be running can setup to be started at boot
680
	to <filename>/etc/rc.conf</filename>.</para>
683
	time by adding these options to
684
	<filename>/etc/rc.conf</filename>:</para>
681
685
682
      <para>On the <acronym>NFS</acronym> server, make sure that the
683
	following options are configured in the
684
	<filename>/etc/rc.conf</filename> file:</para>
685
686
      <programlisting>rpcbind_enable="YES"
686
      <programlisting>rpcbind_enable="YES"
687
nfs_server_enable="YES"
687
nfs_server_enable="YES"
688
mountd_flags="-r"</programlisting>
688
mountd_flags="-r"</programlisting>
Lines 690-713 Link Here
690
      <para><application>mountd</application> runs automatically
690
      <para><application>mountd</application> runs automatically
691
	whenever the <acronym>NFS</acronym> server is enabled.</para>
691
	whenever the <acronym>NFS</acronym> server is enabled.</para>
692
692
693
      <para>On the client, make sure this option is present in
693
      <para>Likewise, to enable the client, make sure this option
694
	<filename>/etc/rc.conf</filename>:</para>
694
	is defined in <filename>/etc/rc.conf</filename>:</para>
695
695
696
      <programlisting>nfs_client_enable="YES"</programlisting>
696
      <programlisting>nfs_client_enable="YES"</programlisting>
697
697
698
      <para>The <filename>/etc/exports</filename> file specifies which
698
      <para>The <filename>/etc/exports</filename> file specifies which
699
	file systems <acronym>NFS</acronym> should export (sometimes
699
	file systems the <acronym>NFS</acronym> server will
700
	referred to as <quote>share</quote>).  Each line in
700
	export (sometimes referred to as <quote>share</quote>).  Each
701
	<filename>/etc/exports</filename> specifies a file system to
701
	line in <filename>/etc/exports</filename> specifies a
702
	be exported and which machines have access to that file
702
	file system to be exported and which clients have access
703
	system.  Along with what machines have access to that file
703
	to that file system, as well as, any access options that may
704
	system, access options may also be specified.  There are many
704
	be specified.  There are many such options that can be
705
	such options that can be used in this file but only a few will
705
	used in this file but only a few will be mentioned here.
706
	be mentioned here.  Other options are discussed in
706
	Other options are discussed in the &man.exports.5;
707
	the &man.exports.5; manual page.</para>
707
	manual page.</para>
708
708
709
      <para>Here are a few example <filename>/etc/exports</filename>
710
	entries:</para>
711
709
712
      <indexterm>
710
      <indexterm>
713
	<primary>NFS</primary>
711
	<primary>NFS</primary>
Lines 716-784 Link Here
716
714
717
      <para>The following examples give an idea of how to export file
715
      <para>The following examples give an idea of how to export file
718
	systems, although the settings may be different depending on
716
	systems, although the settings may be different depending on
719
	the environment and network configuration.  For instance, to
717
	the environment and network configuration.</para>
720
	export the <filename>/cdrom</filename> directory to three
721
	example machines that have the same domain name as the server
722
	(hence the lack of a domain name for each) or have entries in
723
	the <filename>/etc/hosts</filename> file.  The
724
	<option>-ro</option> flag makes the exported file system
725
	read-only.  With this flag, the remote system will not be able
726
	to write any changes to the exported file system.</para>
727
718
719
      <para>Typical <filename>/etc/exports</filename> entries
720
	may include:</para>
721
722
      <para>To export the <filename>/cdrom</filename> directory to
723
	three clients that are either within the same domain as
724
	the server or are defined in the server's
725
	<filename>/etc/hosts</filename> file (allowing for
726
	client reference by their short names):</para>
727
728
      <programlisting>/cdrom -ro host1 host2 host3</programlisting>
728
      <programlisting>/cdrom -ro host1 host2 host3</programlisting>
729
729
730
      <para>The following line exports <filename>/home</filename> to
730
      <para>The <literal>-ro</literal> flag makes the exported file
731
	three hosts by IP address.  This is a useful setup on
731
	system read-only, preventing the clients from making any
732
	a private network without a <acronym>DNS</acronym> server
732
	changes to the exported file system.</para>
733
734
      <para>The next example exports <filename>/home</filename> to
735
	three clients by IP address.  This is a useful setup for
736
	networks that may not have a <acronym>DNS</acronym> server
733
	configured.  Optionally the <filename>/etc/hosts</filename>
737
	configured.  Optionally the <filename>/etc/hosts</filename>
734
	file could be configured for internal hostnames; please review
738
	file could be configured for internal hostnames; please review
735
	&man.hosts.5; for more information.  The
739
	&man.hosts.5; for more information.  The
736
	<option>-alldirs</option> flag allows the subdirectories to be
740
	<literal>-alldirs</literal> flag allows the subdirectories
737
	mount points.  In other words, it will not mount the
741
	to be mount points.  In other words, it will not mount the
738
	subdirectories but permit the client to mount only the
742
	subdirectories but permit the client to mount only the
739
	directories that are required or needed.</para>
743
	directories that are required or needed.</para>
740
744
741
      <programlisting>/home  -alldirs  10.0.0.2 10.0.0.3 10.0.0.4</programlisting>
745
      <programlisting>/home  -alldirs  10.0.0.2 10.0.0.3 10.0.0.4</programlisting>
742
746
743
      <para>The following line exports <filename>/a</filename> so that
747
      <para>This next line exports <filename>/a</filename> so that
744
	two clients from different domains may access the file system.
748
	two clients from different domains may access the file system.
745
	The <option>-maproot=root</option> flag allows the
749
	The <option>-maproot=root</option> flag allows the
746
	<username>root</username> user on the remote system to write
750
	<username>root</username> user on the remote system to write
747
	data on the exported file system as <username>root</username>.
751
	data on the exported file system as <username>root</username>.
748
	If the <literal>-maproot=root</literal> flag is not specified,
752
	If the <literal>-maproot=root</literal> flag is not specified,
749
	then even if a user has <username>root</username> access on
753
	the client's <username>root</username> user will be mapped
750
	the remote system, he will not be able to modify files on
754
	to the server's <username>nobody</username> account and will
751
	the exported file system.</para>
755
	be subject to the access limitations set for the
756
	<username>nobody</username> user.</para>
752
757
753
      <programlisting>/a  -maproot=root  host.example.com box.example.org</programlisting>
758
      <programlisting>/a  -maproot=root  host.example.com box.example.org</programlisting>
754
759
755
      <para>In order for a client to access an exported file system,
760
      <para>For a client to have access to an exported file system,
756
	the client must have permission to do so.  Make sure the
761
	make sure it is listed in
757
	client is listed in <filename>/etc/exports</filename>.</para>
762
	<filename>/etc/exports</filename>.</para>
758
763
759
      <para>In <filename>/etc/exports</filename>, each line represents
764
      <para>In <filename>/etc/exports</filename>, each line defines
760
	the export information for one file system to one host.  A
765
	the export information for one file system to one or more
761
	remote host can only be specified once per file system, and
766
	clients.  A remote host can only be specified once per file
762
	may only have one default entry.  For example, assume that
767
	system, and may only have one default entry.  For example,
763
	<filename>/usr</filename> is a single file system.  The
768
	assume that <filename>/usr</filename> is a single file
764
	following <filename>/etc/exports</filename> would be
769
	system.  The following <filename>/etc/exports</filename>
765
	invalid:</para>
770
	would be invalid:</para>
766
771
767
      <programlisting># Invalid when /usr is one file system
772
      <programlisting># Invalid when /usr is one file system
768
/usr/src   client
773
/usr/src   client
769
/usr/ports client</programlisting>
774
/usr/ports client</programlisting>
770
775
771
      <para>One file system, <filename>/usr</filename>, has two lines
776
      <para>The <filename>/usr</filename> file system has two lines
772
	specifying exports to the same host, <hostid>client</hostid>.
777
	specifying exports to the same host, <hostid>client</hostid>.
773
	The correct format for this situation is:</para>
778
	The correct format for this situation is:</para>
774
779
775
      <programlisting>/usr/src /usr/ports  client</programlisting>
780
      <programlisting>/usr/src /usr/ports  client</programlisting>
776
781
777
      <para>The properties of one file system exported to a given host
782
      <para>The properties of one file system, exported to a given
778
	must all occur on one line.  Lines without a client specified
783
	host, must within a single line.  Lines without a client
779
	are treated as a single host.  This limits how file systems
784
	specified are treated as a single host.  This limits how
780
	may be exported; however, for most environments, this is not
785
	file systems may be exported; however, for most environments,
781
	an issue.</para>
786
	this is not an issue.</para>
782
787
783
      <para>The following is an example of a valid export list, where
788
      <para>The following is an example of a valid export list, where
784
	<filename>/usr</filename> and <filename>/exports</filename>
789
	<filename>/usr</filename> and <filename>/exports</filename>
Lines 793-803 Link Here
793
/exports -alldirs -maproot=root      client01 client02
798
/exports -alldirs -maproot=root      client01 client02
794
/exports/obj -ro</programlisting>
799
/exports/obj -ro</programlisting>
795
800
796
      <para>The <application>mountd</application> daemon must be
801
      <para>The <application>mountd</application> daemon only reads
797
	forced to recheck the <filename>/etc/exports</filename> file
802
	<filename>/etc/exports</filename> at start up.  To make
798
	whenever it has been modified, so the changes can take effect.
803
	<acronym>NFS</acronym> server changes immediately, it must be
799
	This can be accomplished either by sending a HUP signal to the
804
	forced to recheck the <filename>/etc/exports</filename> file.
800
	running daemon:</para>
805
	The two recommended methods for executing immediate change
806
	are:</para>
801
807
802
      <screen>&prompt.root; <userinput>kill -HUP `cat /var/run/mountd.pid`</userinput></screen>
808
      <screen>&prompt.root; <userinput>kill -HUP `cat /var/run/mountd.pid`</userinput></screen>
803
809
Lines 809-816 Link Here
809
      <para>Please refer to <xref linkend="configtuning-rcd"/> for
815
      <para>Please refer to <xref linkend="configtuning-rcd"/> for
810
	more information about using rc scripts.</para>
816
	more information about using rc scripts.</para>
811
817
812
      <para>NFS services can now be started by running the following
818
      <para>On a new server being configured with
813
	command, on the <acronym>NFS</acronym> server, as
819
	<acronym>NFS</acronym> services, the server can be started by
820
	running the following command as
814
	<username>root</username>:</para>
821
	<username>root</username>:</para>
815
822
816
      <screen>&prompt.root; <userinput>service nfsd start</userinput></screen>
823
      <screen>&prompt.root; <userinput>service nfsd start</userinput></screen>
Lines 819-829 Link Here
819
826
820
      <screen>&prompt.root; <userinput>service nfsclient restart</userinput></screen>
827
      <screen>&prompt.root; <userinput>service nfsclient restart</userinput></screen>
821
828
822
      <para>Now everything should be ready to actually mount a remote
829
      <para>The client now has everything it needs to mount a remote
823
	file system.  In these examples the server's name will be
830
	file system.  In these examples, the server's name will be
824
	<hostid>server</hostid> and the client's name will be
831
	<hostid>server</hostid> and the client's name will be
825
	<hostid>client</hostid>.  For testing or to temporarily mount
832
	<hostid>client</hostid>.  For testing or to temporarily mount
826
	a remote file system execute a command like this as
833
	a remote file system execute the
834
	<application>mount</application> command as
827
	<username>root</username> on the client:</para>
835
	<username>root</username> on the client:</para>
828
836
829
      <indexterm>
837
      <indexterm>
Lines 832-847 Link Here
832
      </indexterm>
840
      </indexterm>
833
      <screen>&prompt.root; <userinput>mount server:/home /mnt</userinput></screen>
841
      <screen>&prompt.root; <userinput>mount server:/home /mnt</userinput></screen>
834
842
835
      <para>This will mount the <filename>/home</filename> directory
843
      <para>This will mount the server's <filename>/home</filename>
836
	on the server at <filename>/mnt</filename> on the client.  If
844
	file system at <filename>/mnt</filename> on the client.  If
837
	everything is set up correctly, the server's files should be
845
	everything is set up correctly, the server's files should be
838
	visible and available in the <filename>/mnt</filename>
846
	visible and available in the client's
839
	directory.</para>
847
	<filename>/mnt</filename> directory.</para>
840
848
841
      <para>To permanently mount a remote file system each time the
849
      <para>To permanently mount a remote file system each time the
842
	computer boots, add the file system to the
850
	client boots, add the remote file system to the
843
	<filename>/etc/fstab</filename> file.  Here is an
851
	<filename>/etc/fstab</filename> file:</para>
844
	example:</para>
845
852
846
      <programlisting>server:/home	/mnt	nfs	rw	0	0</programlisting>
853
      <programlisting>server:/home	/mnt	nfs	rw	0	0</programlisting>
847
854
Lines 855-879 Link Here
855
      <para>Some applications (e.g., <application>mutt</application>)
862
      <para>Some applications (e.g., <application>mutt</application>)
856
	require file locking to operate correctly.  In the case of
863
	require file locking to operate correctly.  In the case of
857
	<acronym>NFS</acronym>, <application>rpc.lockd</application>
864
	<acronym>NFS</acronym>, <application>rpc.lockd</application>
858
	can be used for file locking.  To enable it, add the following
865
	can be used for file locking.  To enable it, add this line
859
	to the <filename>/etc/rc.conf</filename> file on both client
866
	to the <filename>/etc/rc.conf</filename> file on both client
860
	and server (it is assumed that the <acronym>NFS</acronym>
867
	and server:</para>
861
	client and server are configured already):</para>
862
868
863
      <programlisting>rpc_lockd_enable="YES"
869
      <programlisting>rpc_lockd_enable="YES"
864
rpc_statd_enable="YES"</programlisting>
870
rpc_statd_enable="YES"</programlisting>
865
871
866
      <para>Start the application by using:</para>
872
      <para>Please note that this assumes that both
873
	<acronym>NFS</acronym> client and server are already
874
	configured.</para>
867
875
876
      <para>Start the application, as root, by using:</para>
877
868
      <screen>&prompt.root; <userinput>service lockd start</userinput>
878
      <screen>&prompt.root; <userinput>service lockd start</userinput>
869
&prompt.root; <userinput>service statd start</userinput></screen>
879
&prompt.root; <userinput>service statd start</userinput></screen>
870
880
871
      <para>If real locking between the <acronym>NFS</acronym> clients
881
      <para>If locking is not required, the <acronym>NFS</acronym>
872
	and <acronym>NFS</acronym> server is not required, it is
882
	client can be configured to lock locally by passing
873
	possible to let the <acronym>NFS</acronym> client do locking
883
	<option>-L</option> to &man.mount.nfs.8;.  Refer to the
874
	locally by passing <option>-L</option> to &man.mount.nfs.8;.
884
	&man.mount.nfs.8; manual page for further details.</para>
875
	Refer to the &man.mount.nfs.8; manual page for further
876
	details.</para>
877
    </sect2>
885
    </sect2>
878
886
879
    <sect2>
887
    <sect2>
Lines 880-886 Link Here
880
      <title>Practical Uses</title>
888
      <title>Practical Uses</title>
881
889
882
      <para><acronym>NFS</acronym> has many practical uses.  Some of
890
      <para><acronym>NFS</acronym> has many practical uses.  Some of
883
	the more common ones are listed below:</para>
891
	the more common uses:</para>
884
892
885
      <indexterm>
893
      <indexterm>
886
	<primary>NFS</primary>
894
	<primary>NFS</primary>
Lines 888-912 Link Here
888
      </indexterm>
896
      </indexterm>
889
      <itemizedlist>
897
      <itemizedlist>
890
	<listitem>
898
	<listitem>
891
	  <para>Set several machines to share a CDROM or other media
899
	  <para>Share a <acronym>CD/DVD-ROM</acronym> or other media
892
	    among them.  This is cheaper and often a more convenient
900
	    to any number of clients.  This is cheaper and often a
893
	    method to install software on multiple machines.</para>
901
	    more convenient method to install software on multiple
902
	    machines.</para>
894
	</listitem>
903
	</listitem>
895
904
896
	<listitem>
905
	<listitem>
897
	  <para>On large networks, it might be more convenient to
906
	  <para>On large networks, it is more convenient to
898
	    configure a central <acronym>NFS</acronym> server in which
907
	    configure a central <acronym>NFS</acronym> server on which
899
	    to store all the user home directories.  These home
908
	    all user home directories are stored.  The exported
900
	    directories can then be exported to the network so that
909
	    home directories can then be accessed by authorized
901
	    users would always have the same home directory,
910
	    clients, allowing authenticated users access to
902
	    regardless of which workstation they log in to.</para>
911
	    their data.</para>
903
	</listitem>
912
	</listitem>
904
913
905
	<listitem>
914
	<listitem>
906
	  <para>Several machines could have a common
915
	  <para>Several clients could have a need for the
907
	    <filename>/usr/ports/distfiles</filename> directory.  This
916
	    <filename>/usr/ports/distfiles</filename> directory.  This
908
	    allows for quick access to the source files without
917
	    allows for quick access to the source files without
909
	    downloading them on each machine.</para>
918
	    having to download them to each client.</para>
910
	</listitem>
919
	</listitem>
911
      </itemizedlist>
920
      </itemizedlist>
912
    </sect2>
921
    </sect2>
Lines 937-963 Link Here
937
      </indexterm>
946
      </indexterm>
938
947
939
      <para>&man.amd.8; (the automatic mounter daemon) automatically
948
      <para>&man.amd.8; (the automatic mounter daemon) automatically
940
	mounts a remote file system whenever a file or directory
949
	mounts or unmounts a remote file system.  It performs a
941
	within that file system is accessed.  Filesystems that are
950
	mount whenever a file or directory within a managed, remote
942
	inactive for a period of time will also be automatically
951
	file system is accessed.  Likewise,
943
	unmounted by <application>amd</application>.  Using
952
	<application>amd</application> unmounts a remote file
953
	system if it has been inactive for a period of time.  Using
944
	<application>amd</application> provides a simple alternative
954
	<application>amd</application> provides a simple alternative
945
	to permanent mounts, as permanent mounts are usually listed in
955
	to permanent mounts which are permanently listed in
946
	<filename>/etc/fstab</filename>.</para>
956
	<filename>/etc/fstab</filename>.</para>
947
957
948
      <para><application>amd</application> operates by attaching
958
      <para>By default, <application>amd</application> operates
949
	itself as an NFS server to the <filename>/host</filename> and
959
	by attaching itself as an NFS server to the
950
	<filename>/net</filename> directories.  When a file is
960
	<filename>/host</filename> and <filename>/net</filename>
951
	accessed within one of these directories,
961
	directories.  When a file is accessed within one of these
952
	<application>amd</application> looks up the corresponding
962
	directories, <application>amd</application> looks up the
953
	remote mount and automatically mounts it.
963
	corresponding remote mount and automatically mounts it.
954
	<filename>/net</filename> is used to mount an exported file
964
	<filename>/net</filename> is used to mount an exported file
955
	system from an IP address, while <filename>/host</filename> is
965
	system from an IP address, while <filename>/host</filename> is
956
	used to mount an export from a remote hostname.</para>
966
	used to mount an export from a remote hostname.</para>
957
967
958
      <para>An access to a file within
968
      <para>For instance, an attempt to access a file within
959
	<filename>/host/foobar/usr</filename> would tell
969
	<filename>/host/foobar/usr</filename> would tell
960
	<application>amd</application> to attempt to mount the
970
	<application>amd</application> to mount the
961
	<filename>/usr</filename> export on the host
971
	<filename>/usr</filename> export on the host
962
	<hostid>foobar</hostid>.</para>
972
	<hostid>foobar</hostid>.</para>
963
973
Lines 965-973 Link Here
965
	<title>Mounting an Export with
975
	<title>Mounting an Export with
966
	  <application>amd</application></title>
976
	  <application>amd</application></title>
967
977
968
	<para>The <command>showmount</command> command shows the
978
	<para>The <command>showmount</command>, with the
969
	  available mounts on a remote host.  For example, to view the
979
	  <literal>-e</literal> flag, shows the exported file systems
970
	  mounts of a host named <hostid>foobar</hostid>:</para>
980
	  available for mount from the remote <acronym>NFS</acronym>
981
	  server:</para>
971
982
972
	<screen>&prompt.user; <userinput>showmount -e foobar</userinput>
983
	<screen>&prompt.user; <userinput>showmount -e foobar</userinput>
973
Exports list on foobar:
984
Exports list on foobar:
Lines 976-998 Link Here
976
&prompt.user; <userinput>cd /host/foobar/usr</userinput></screen>
987
&prompt.user; <userinput>cd /host/foobar/usr</userinput></screen>
977
      </example>
988
      </example>
978
989
979
      <para>As seen in the example, the <command>showmount</command>
990
      <para>The output from <command>showmount</command>
980
	shows <filename>/usr</filename> as an export.  When changing
991
	shows <filename>/usr</filename> as an export.  When changing
981
	directories to <filename>/host/foobar/usr</filename>,
992
	directories to <filename>/host/foobar/usr</filename>,
982
	<application>amd</application> attempts to resolve the
993
	<application>amd</application> intercepts the request and
983
	hostname <hostid>foobar</hostid> and automatically mount the
994
	attempts to resolve the hostname <hostid>foobar</hostid>.
984
	desired export.</para>
995
	If successful, <application>amd</application> automatically
996
	mounts the desired export.</para>
985
997
986
      <para><application>amd</application> can be started by the
998
      <para><application>amd</application> is enabled by placing
987
	startup scripts by placing the following lines in
999
	the following lines <filename>/etc/rc.conf</filename>:</para>
988
	<filename>/etc/rc.conf</filename>:</para>
989
1000
990
      <programlisting>amd_enable="YES"</programlisting>
1001
      <programlisting>amd_enable="YES"</programlisting>
991
1002
992
      <para>Additionally, custom flags can be passed to
1003
      <para>It can then be started using the &os; &man.rc.8; scripts
1004
	or by using the &man.service.8; command.</para>
1005
1006
      <para>Custom flags can be passed to
993
	<application>amd</application> from the
1007
	<application>amd</application> from the
994
	<varname>amd_flags</varname> option.  By default,
1008
	<varname>amd_flags</varname> environment variable.  By
995
	<varname>amd_flags</varname> is set to:</para>
1009
	default, <varname>amd_flags</varname> is set to:</para>
996
1010
997
      <programlisting>amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"</programlisting>
1011
      <programlisting>amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"</programlisting>
998
1012
Lines 1018-1090 Link Here
1018
      </sect2info>
1032
      </sect2info>
1019
      <title>Problems Integrating with Other Systems</title>
1033
      <title>Problems Integrating with Other Systems</title>
1020
1034
1021
      <para>Certain Ethernet adapters for ISA PC systems have
1035
      <para>Certain Ethernet adapters, for ISA bus-type PC
1022
	limitations which can lead to serious network problems,
1036
	systems, have limitations which can lead to serious network
1023
	particularly with NFS.  This difficulty is not specific to
1037
	problems, particularly with NFS.  While this is not
1024
	FreeBSD, but FreeBSD systems are affected by it.</para>
1038
	specific to &os;, &os; systems built on this type
1039
	of hardware are affected.</para>
1025
1040
1026
      <para>The problem nearly always occurs when (FreeBSD) PC systems
1041
      <para>The problem occurs when these systems are networked
1027
	are networked with high-performance workstations, such as
1042
	with high-performance workstations, such as those made by
1028
	those made by Silicon Graphics, Inc., and Sun Microsystems,
1043
	Silicon Graphics, Inc., and Sun Microsystems, Inc.  The
1029
	Inc.  The NFS mount will work fine, and some operations may
1044
	NFS mount will work fine, and initial operations may
1030
	succeed, but suddenly the server will seem to become
1045
	succeed.  Eventually the server will become unresponsive
1031
	unresponsive to the client, even though requests to and from
1046
	to the client, even though requests to and from
1032
	other systems continue to be processed.  This happens to the
1047
	other systems continue unaffected.  Once this has occurred,
1033
	client system, whether the client is the FreeBSD system or the
1048
	there is no way to shut the client down gracefully.  The
1034
	workstation.  On many systems, there is no way to shut down
1049
	only solution is to reboot the client.</para>
1035
	the client gracefully once this problem has manifested itself.
1036
	The only solution is often to reset the client, because the
1037
	NFS situation cannot be resolved.</para>
1038
1050
1039
      <para>Though the <quote>correct</quote> solution is to get a
1051
      <para>Though the <quote>correct</quote> solution is to get a
1040
	higher performance and capacity Ethernet adapter for the
1052
	higher performance and capacity Ethernet adapter for the
1041
	FreeBSD system, there is a simple workaround that will allow
1053
	&os; system, there is a simple workaround.  If the
1042
	satisfactory operation.  If the FreeBSD system is the
1054
	&os; system is the <emphasis>server</emphasis>, include
1043
	<emphasis>server</emphasis>, include the option
1055
	the option <literal>-w=1024</literal> in the client's
1044
	<option>-w=1024</option> on the mount from the client.  If the
1056
	<command>mount</command> command.  If the &os; system is
1045
	FreeBSD system is the <emphasis>client</emphasis>, then mount
1057
	the <emphasis>client</emphasis>, then mount the NFS file
1046
	the NFS file system with the option <option>-r=1024</option>.
1058
	system with the option <option>-r=1024</option>.  These
1047
	These options may be specified using the fourth field of the
1059
	options may be specified using the fourth field of the
1048
	<filename>fstab</filename> entry on the client for automatic
1060
	<filename>/etc/fstab</filename> entry on the client for
1049
	mounts, or by using the <option>-o</option> parameter of the
1061
	automatic mounts, or by using the <option>-o</option>
1050
	&man.mount.8; command for manual mounts.</para>
1062
	parameter of the &man.mount.8; command for manual
1063
	mounts.</para>
1051
1064
1052
      <para>It should be noted that there is a different problem,
1065
      <para>It should be noted that there is a similar problem
1053
	sometimes mistaken for this one, when the NFS servers and
1066
	requiring a different workaround.  It often manifests
1054
	clients are on different networks.  If that is the case, make
1067
	itself when the NFS servers and clients are on different
1068
	networks.  If that is the case, make
1055
	<emphasis>certain</emphasis> that the routers are routing the
1069
	<emphasis>certain</emphasis> that the routers are routing the
1056
	necessary <acronym>UDP</acronym> information.</para>
1070
	necessary <acronym>UDP</acronym> information.  In other
1071
	words, a <quote>helper</quote> may need to be enabled for
1072
	the subnets and/or VLANs in question and may require
1073
	consultation with Network Administrators for proper
1074
	configuration.</para>
1057
1075
1058
      <para>In the following examples, <hostid>fastws</hostid> is the
1076
      <para>In these examples, <hostid>fastws</hostid> is the
1059
	host (interface) name of a high-performance workstation, and
1077
	host (interface) name of a high-performance workstation, and
1060
	<hostid>freebox</hostid> is the host (interface) name of a
1078
	<hostid>freebox</hostid> is the host (interface) name of a
1061
	FreeBSD system with a lower-performance Ethernet adapter.
1079
	&os; system with a lower-performance Ethernet adapter.
1062
	Also, <filename>/sharedfs</filename> will be the exported NFS
1080
	The export is the <filename>/sharedfs</filename> file system
1063
	file system (see &man.exports.5;), and
1081
	(see &man.exports.5;), and <filename>/project</filename>
1064
	<filename>/project</filename> will be the mount point on the
1082
	will be the mount point on the client system.  In all cases,
1065
	client for the exported file system.  In all cases, note that
1083
	note that additional options, such as <literal>hard</literal>
1066
	additional options, such as <option>hard</option> or
1084
	or <literal>soft</literal> and <literal>bg</literal> may be
1067
	<option>soft</option> and <option>bg</option> may be desirable
1085
	desirable in the application.</para>
1068
	in the application.</para>
1069
1086
1070
      <para>Examples for the FreeBSD system (<hostid>freebox</hostid>)
1087
      <para>Example of the &os; client, <hostid>freebox</hostid>
1071
	as the client in <filename>/etc/fstab</filename> on
1088
	configured with a permanent mount in
1072
	<hostid>freebox</hostid>:</para>
1089
	<filename>/etc/fstab</filename>:</para>
1073
1074
      <programlisting>fastws:/sharedfs /project nfs rw,-r=1024 0 0</programlisting>
1090
      <programlisting>fastws:/sharedfs /project nfs rw,-r=1024 0 0</programlisting>
1075
1091
1076
      <para>As a manual mount command on
1092
      <para>Now, requesting a manual mount command on &os; client,
1077
	<hostid>freebox</hostid>:</para>
1093
	<hostid>freebox</hostid>:</para>
1078
1094
1079
      <screen>&prompt.root; <userinput>mount -t nfs -o -r=1024 fastws:/sharedfs /project</userinput></screen>
1095
      <screen>&prompt.root; <userinput>mount -t nfs -o -r=1024 fastws:/sharedfs /project</userinput></screen>
1080
1096
1081
      <para>Examples for the FreeBSD system as the server in
1097
      <para>Examples for the &os; system, <hostid>freebox</hostid>
1098
	acting as the <acronym>NFS</acronym> server, with the client
1082
	<filename>/etc/fstab</filename> on
1099
	<filename>/etc/fstab</filename> on
1083
	<hostid>fastws</hostid>:</para>
1100
	<hostid>fastws</hostid>:</para>
1084
1101
1085
      <programlisting>freebox:/sharedfs /project nfs rw,-w=1024 0 0</programlisting>
1102
      <programlisting>freebox:/sharedfs /project nfs rw,-w=1024 0 0</programlisting>
1086
1103
1087
      <para>As a manual mount command on
1104
      <para>As a manual mount command on client,
1088
	<hostid>fastws</hostid>:</para>
1105
	<hostid>fastws</hostid>:</para>
1089
1106
1090
      <screen>&prompt.root; <userinput>mount -t nfs -o -w=1024 freebox:/sharedfs /project</userinput></screen>
1107
      <screen>&prompt.root; <userinput>mount -t nfs -o -w=1024 freebox:/sharedfs /project</userinput></screen>
Lines 1093-1129 Link Here
1093
	without the above restrictions on the read or write
1110
	without the above restrictions on the read or write
1094
	size.</para>
1111
	size.</para>
1095
1112
1096
      <para>For anyone who cares, here is what happens when the
1113
      <para>The symptoms of this failure, and why it is unrecoverable,
1097
	failure occurs, which also explains why it is unrecoverable.
1114
	are explained in the way <acronym>NFS</acronym> works.
1098
	NFS typically works with a <quote>block</quote> size of
1115
	<acronym>NFS</acronym> works with a default
1099
	8&nbsp;K (though it may do fragments of smaller sizes).  Since
1116
	<quote>block</quote> size of 8&nbsp;K (though it may do
1100
	the maximum Ethernet packet is around 1500&nbsp;bytes, the NFS
1117
	fragments of smaller sizes).  Since the typical ethernet
1101
	<quote>block</quote> gets split into multiple Ethernet
1118
	packet is around 1500&nbsp;bytes, the NFS
1102
	packets, even though it is still a single unit to the
1119
	<quote>block</quote> gets split into multiple ethernet
1103
	upper-level code, and must be received, assembled, and
1120
	packets.  These packets then must be re-assembled and
1104
	<emphasis>acknowledged</emphasis> as a unit.  The
1121
	<emphasis>acknowledged</emphasis> wholey, as they are
1105
	high-performance workstations can pump out the packets which
1122
	received by the recipient.  High-performance workstations
1106
	comprise the NFS unit one right after the other, just as close
1123
	can transmit these packets faster than the lower capacity
1107
	together as the standard allows.  On the smaller, lower
1124
	cards can receive them, resulting in a buffer overflow
1108
	capacity cards, the later packets overrun the earlier packets
1125
	condition.  Packets being sent to the client cannot recover,
1109
	of the same unit before they can be transferred to the host
1126
	cannot be reconstructed, and therefore cannot be acknowledged.
1110
	and the unit as a whole cannot be reconstructed or
1127
	Ultimately, the workstation will time out and try again.
1111
	acknowledged.  As a result, the workstation will time out and
1128
	Repeating the request, the server sends the entire 8&nbsp;K
1112
	try again, but it will try again with the entire 8&nbsp;K
1129
	block, and the process is repeated.</para>
1113
	unit, and the process will be repeated, ad infinitum.</para>
1114
1130
1115
      <para>By keeping the unit size below the Ethernet packet size
1131
      <para>By keeping the block size below the Ethernet packet size
1116
	limitation, we ensure that any complete Ethernet packet
1132
	limitation, we ensure that any complete Ethernet packet
1117
	received can be acknowledged individually, avoiding the
1133
	received can be acknowledged individually, avoiding this
1118
	deadlock situation.</para>
1134
	buffer overflow situation.</para>
1119
1135
1120
      <para>Overruns may still occur when a high-performance
1136
      <para>Buffer overflows (aka overruns) may still occur
1121
	workstations is slamming data out to a PC system, but with the
1137
	when a high-performance workstation is transmitting data
1122
	better cards, such overruns are not guaranteed on NFS
1138
	to a client, but with better cards, such overruns are less
1123
	<quote>units</quote>.  When an overrun occurs, the units
1139
	likely.  When an overrun does occur, the blocks affected
1124
	affected will be retransmitted, and there will be a fair
1140
	will be retransmitted, and the client is more likely to
1125
	chance that they will be received, assembled, and
1141
	recover on its own.</para>
1126
	acknowledged.</para>
1127
    </sect2>
1142
    </sect2>
1128
  </sect1>
1143
  </sect1>

Return to bug 181269