************* BACK AND FORTH PAGING SUBROUTINE ************

PAGEFLOP

If they want to quit, do so
 If They want to quit subsession, Do SO!
  Decrement LOCAL and GLOBAL Page Counters

FORWARD

  Increment LOCAL and GLOBAL Page Counters
   *************** END PAGEFLOP *********************
  ****** CHAPTER INTERNAL SELECTOR ALGORITHM ******

SELECTOR

   Reset Local Page Counter

SELAGAIN

 CHECK IF ONLY A <CR>

WRONGSEL

YOUR SELECTION IS NOT IN THE 0 - #SELIMIT  RANGE  Please try again

AANVANG

Copyright CourseWare Technologies Inc. 1985-88


 Lesson - 8


  REMOTE FILE SHARING AND 
  THE NETWORK FILE SYSTEM 

MENU

NFS and RFS|Topics to Learn|8-0|11,52
    #                   Topic
   ---                 -------
    1   -   What is Remote File Sharing (RFS)?
    2   -   What is a Network File System (NFS)?
    3   -   How do RFS and NFS Differ?
    4   -   How does NFS Work?
    5   -   How to Create an NFS Server
    6   -   How to Become an NFS Client
    7   -   Removing a File System from Network Use
    8   -   NFS Problems and Incompatibilities
    9   -   Lesson Review
   10   -   Further Studies
    0   -   Exit This Session

P1

NFS and RFS|What is RFS?|8-1.1|13,55
     RFS (remote file sharing) was developed by AT&T 
to allow computers using System V, Release 3 to share
a single copy of a file system.


     Sharing file systems allows more efficient use of
the available resources.  By avoiding multiple copies
on several machines, users have to remember only one 
location for a file system with particular information.


     RFS is totally transparent to both users and 
programs.

P2

NFS and RFS|What is RFS?|8-1.2|11,54
Let's first define a few terms used with RFS:

     A resource is a file, directory, device, or 
named pipe.


     A server is any machine where a resource resides.


     A client is any machine that uses a resource 
provided by a server.


P3

NFS and RFS|What is RFS?|8-1.3|11,54
     A machine can be a server for some resources and a
client for others.


     Server machines start RFS processes with the rfstart
command and advertise resources with the adv command.  


     Client machines start RFS, determine what resources 
are available with the nsquery command, define where to 
mount directories, and mount the resources with the mount 
command.

P4

NFS and RFS|What is NFS?|8-2.1|6,54
     Sun's Network File System (NFS) service allows 
files and directories to be shared over a common 
network consisting of various machines like Suns, 
VAXes, mainframes, database machines, PCs, etc.  
Such machines can share files even if they don't 
run the UNIX Operating System!

P5

NFS and RFS|What is NFS?|8-2.2|10,54
     Any file system that is not on your machine is
called a remote file system.  


     NFS service makes remote file systems appear to be 
mounted locally.  This means that files can be accessed 
with standard I/O calls regardless of their location.  
Users and programs manipulate files as usual even 
though parts of the file system may reside on various 
machines on the network.

P6

NFS and RFS|What is NFS?|8-2.3|11,54
     A server is any machine that provides a network 
service.  Servers are passive, that is, they wait for 
clients to call them and ask them to make files or 
file systems available to them.  Making file systems 
available is called exporting.


     A client is any machine or process that accesses 
a network service.  Clients initiate a service by 
importing files or file systems.  NFS clients may 
choose to mount file systems from any number of 
servers at any time.  

P7

NFS and RFS|What is NFS?|8-2.4|7,50
     Each computer on the network is called a node.


     Each node has a unique name.


     A node may act as a server or a client or both.

P8

NFS and RFS|How Do RFS and NFS Differ?|8-3.1|12,54
     NFS and RFS are functionally very similar, but they
are implemented very differently.  NFS is a stateless 
service, designed for use in a hetrerogeneous environment; 
therefore, it does not support all of the UNIX file system 
semantics (like file locking and append mode operations).
RFS is a stateful service, designed for a UNIX environment 
only, and therefore provides complete UNIX semantics.


     If a server dies in RFS, the clients must reinitialize 
with the server and programs restarted.  NFS allows a server 
to go down and back up without the client even noticing.
NFS and RFS|How Do RFS and NFS Differ?|8-3.2|11,54
     NFS was developed by Sun Microsystems; RFS was
developed by AT&T.


     RFS works only with UNIX System V, Release 3;
NFS works with UNIX as well as other operating systems.


     NFS has greater industry support because it is 
compatible with different hardware and operating systems.
We shall, therefore, stress NFS in this course.

P9

NFS and RFS|How Does NFS Work?|8-4.1|12,58
     The /etc/exports file contains the pathnames of
all file systems that are available for mounting on
other machines--a process known as exporting.


     Two programs implement NFS service:

      nfsd - starts the daemons on the server that handle 
             requests for service.
    mountd - is a server that answers file system mount 
             requests.  It reads the /etc/exports file to 
             determine which file systems are available to 
             which machines and users.

P10

NFS and RFS|How Does NFS Work?|8-4.2|5,52
     Once NFS is implemented, a client can gain 
access to a remote file system by mounting it with 
the mount command.  Then the mountd program will 
check the access permissions and return a pointer 
to the file system.

P11

NFS and RFS|How to Create an NFS Server|8-5.1|6,57
We'll walk you through the steps to create an NFS server.

  1.  First, you need to become a superuser.

  2.  Second, edit the /etc/exports file to include the 
      pathname of the file system(s) you want to export.  

P12

NFS and RFS|How to Create an NFS Server|8-5.2|12,54
Suppose, for example, that Mickey works on a computer 
called mouse and Donald works on a computer called
duck, both of which are on the same network.  Mickey
and Donald share a common project, so Donald wants to 
make the directory /usr/cartoon available for Mickey 
to use from his computer.  Donald would add the following 
line to the /etc/exports file on his computer:

/usr/cartoon      mouse

That is, the /usr/cartoon directory is available for 
mounting on the computer called mouse.

P13

NFS and RFS|How to Create an NFS Server|8-5.3|6,54
3.  Look at /etc/servers on the server and make sure 
it contains the following line:

rpc     udp   /usr/etc/rpc.mountd  100005   1

Add this line if it isn't there.

P14

NFS and RFS|How to Create an NFS Server|8-5.4|9,54
4.  Look at /etc/rc.local for lines line these:

     if [ -f /etc/nfsd -a -f /etc/exports ];  then
     /etc/nfsd 4 & echo -n ' nfsd'   >/dev/console

This file contains commands that are automatically 
executed when your system is booted.  (The above lines 
mean if the nfsd and exports files exist, start 4 NFS 
daemons and print the message "nfsd" on the console 
terminal.

P15

NFS and RFS|How to Create an NFS Server|8-5.5|7,54
5.  Enable nfsd by typing:

/etc/nfds 4

The 4 means to start 4 daemons to handle client file 
system requests.  (4 is the usual number.)

P16

NFS and RFS|How to Become an NFS Client|8-6.1|14,54
     To become a client, you need to mount the 
file system that you wish to import.


     From the machine that you want to mount the 
file system on, the syntax would be:

mount  server name:/file system  /mount point

For example, Mickey would mount Donald's /usr/cartoon 
directory (from the server machine: duck) on the 
/jointproj directory on his machine by typing:

mount  duck:/usr/cartoon  /jointproj

P17

NFS and RFS|How to Become an NFS Client|8-6.2|7,54
     You can check the effect of the mount by typing 
either df or mount.  Imported file systems are 
preceded by the server name followed by a colon.


     The showmount command indicates which clients 
have file systems mounted.

P18

NFS and RFS|How to Become an NFS Client|8-6.3|8,54
     You can mount frequently used file systems at 
startup by placing an entry for them in /etc/fstab.
For example:

duck:/usr/cartoon /jointproj nfs rw,soft 1 1

See the manual page for fstab for an explanation of 
the fields.

P19

NFS and RFS|How to Become an NFS Client|8-6.4|11,54
     Once file systems are mounted, you can access
files on the remote machine as you would if they were
on your machine.


     Suppose, for example, that you want to print
the file script in the usr/movie directory on the on
the duck machine.  Remember, you mounted that file 
system on /usr/jointproj on your machine, so you can 
cd /usr/jointproj and vi script (provided you have
access permission of course.)

P20

NFS and RFS|Removing a File System from Network Use|8-7.1|7,54
     To make a file system unavailable:

      *  it must be removed from the /etc/exports file
         on the server and 

      *  the client must unmount it with the umount
         command.

P21

NFS and RFS|NFS Problems and Incompatibilities|8-8.1|14,58
     Under NFS, root has the same access privileges as 
a regular user, so even when a client becomes superuser, 
it is still considered to be in the user class OTHER.  
Therefore, programs that run as setuid root cannot access
files or directories unless OTHER has permission.  This 
can be a problem when installing software or doing dumps 
and restores.


     To further complicate the issue, you cannot change
the ownership of remote mounted files.  Since a user 
cannot do a chown (and root is considered a normal 
user), only root on the server can change the ownership 
of remote files.

P22

NFS and RFS|NFS Problems and Incompatibilities|8-8.2|13,54
     To change ownership, you can do one of the 
following two things:

  *  login to the server as root and make the change 
     there.  (Remember, you can determine the server 
     from the output of df.) 
  *  Or, you can move the file to someplace owned by your 
     machine (like /usr/tmp) and make the change there.


     You could change the value of the kernel variable 
to "nobody" in the NFS server's kernel, but it is not 
recommended for security reasons.

P23

NFS and RFS|NFS Problems and Incompatibilities|8-8.3|11,54
     File locking is not supported on remote file 
systems.


     Normally, when a file is opened by two users at the
same time and both try to append something to the end, 
only one users data will be included.  (This is called 
an atomic operation because it cannot be broken in the 
middle.)  However, with NFS, part of the data from each 
user will be mixed together in the file when a remote 
file is accessed by more than one client simultaneously.

P24

NFS and RFS|NFS Problems and Incompatibilities|8-8.4|10,54
     With NFS, you cannot access a device (like a 
terminal) in a directory that is mounted remotely 
(the /dev directory, for example).  The properties 
of "special" files are not transported with the NFS 
partition so you cannot access any other character 
or block special files--like named pipes.


     Because every workstation keeps its own time, the 
clocks may be out of sync between a server and client.

P25

NFS and RFS|NFS Problems and Incompatibilities|8-8.5|7,54
     The /usr/etc/nfsstat command will display 
statistical information about the Network File System.  
If no options are supplied, it will display:

                *  client information
                *  server information
                *  NFS information

P26

Advanced Administrator|Further Studies|8-10.1|15,54
     At this point, if you have covered all of the 
lessons in this and in the preceding CTI tutorials, you 
should have a good base for performing various UNIX system 
administration tasks.


     You should review the course more than once for 
better comprehension.  You should also refer to your 
System Administration manuals for details pertaining 
to your system setup.


     Because your actions affect the system health and 
the data integrity, please perform only those tasks of 
which you are certain.

P27

Advanced Administrator|Further Studies|8-10.2|12,64
     We at CTI wish you great success in all of your
UNIX endeavors.


                CourseWare Technologies Inc.                  
                 11230 Sorrento Valley Road                   
                         Suite 115                            
                   San Diego, CA   92121                      
                    Tel: (619) 452-UNIX                       
                    Tel: (619) 452-8649                       
                    FAX: 1-619 452-8711