Table of Contents Previous Chapter Using an NFS server.
Server host must first be configured to allow your host to mount directories
- /etc/exports defines the directories that are exported and which hosts are allowed to mount them(SunOS 5.x uses /etc/dfs/dfstab in slightly different way)
- exportfs is used to make directories available for mounting(SunOS 5.x systems use the share and unshare commands)
- /etc/xtab lists information about currently exported directories
- mountd processes mount requests, verifying that requesting clients are allowed to mount by reading the /etc/xtab file
Here is an example of an /etc/exports file.
Your host must then mount the remote directories
- showmount will show mountable file systems on remote machines(Here is an example of using showmount)
- mount command used to mount directories, e.g.
mount host.dept.washington.edu:/usr/man/usr/man
mount host.dept.washington.edu:/usr/users/home
- /etc/fstab contains list of all file systems mounted by default
- Can use mount -p to help build /etc/fstab entries
Tabell 7: Commonly used NFS mount flags
-----------------------------------------------------------------------
Flag Description
-----------------------------------------------------------------------
ro Mount the file system read-only
rw Mount the file system read/write (only if server exports as
writable)
bg If the server doesn't respond, keep trying the mount in the
background - may also hang startup scripts, or cause
strange failures, if they rely on files in these file systems
hard Blocks processes accessing files until server can respond
(may look like your shell has "hung")
soft Processes trying to access files get an error message if
server is not responding
intr Allows user to abort a blocked access (returns error also)
timeo= Timeout period (in tenths of a second) for requests
retrans= Specify number of times to retry requests before return
ing an error when soft mount used.
-----------------------------------------------------------------------
- Ownership represented by numeric UID/GID values, which correspond to logins viathe /etc/passwd file on both client and server!(What if UIDs don't match?)
- Security is a problem (e.g., can chown be used to give files away?).See Unix System Security Checklist for details.
- NFS is a "stateless" protocol. What happens if the server goes down?
- "NFS: stale file handle" error message means re-mount file systems
- "Hard mount" is "Energizer Bunny" mode. Client keeps trying, and trying, and trying.... Unless interrupts allowed, client will "hang" until server comes back up
- "Soft mount" means client gets an error message.
- File locking can be a problem.
- Easy to "waste" bandwidth by transferring files twice!(e.g., ftp to/from an NFS mounted file system on a client)
- Forgetting to use -xdev (or -mount, etc)., when using find.
- Differences in maximum block sizes between client/server file systems can cause programs to crash
- "How to Develop a Distributed Filesystem Model," Michael S. Hill, Sys Admin, August 1996
- "Hidden Dangers of NFS Mounting Foreign File Systems," Doug Morris, Sys Admin, August 1996
Table of Contents Next Chapter