Configuring NFS
NFS Server Files
/etc/dfs/dfstab Lists the local resources to share at boot time
/etc/dfs/sharetab Lists the local resources currently being shared.
/etc/dfs/fstypes Lists the default FS types for remote FS
/etc/rmtab Lists FS remotely mounted by NFS clients
/etc/nfs/nfslog.conf Lists info of the location of config logs used for NFS server logging
/etc/default/nfslogd Lists config info describing the behavior of the nfslogd daemon
# cat /etc/dfs/dfstab
share –F nfs –o ro /export.sys44_data
# cat /etc/dfs/sharetab
/export/sys44_data - nfs ro
# cat /etc/dfs/fstypes
nfs NFS Utilities
autofs AUTOFS Utilities
cachefs CACHEFS Utilities
# cat /etc/rmtab
sys42:/export/sys44-data
#sys41:/usr/share/man
#sys43:/export/sys44_data -- The # entries are removed by the mountd daemon during a
system startup
NFS Server Daemons
To start the NFS server daemons or to specify the number of concurrent NFS requests that can be handled by the nfsd daemon, use the /etc/rc3.d/S15nfs.server script
mountd Handles FS mount requests from remote systems, and provides access control
nfsd Handles client FS requests
statd Works with the lockd daemon to provide crash recovery functions for the lock
manager
lockd Supports record locking operations on NFS files
nfslogd Provides operational logging
# /etc/init.d/nfs.server start -- To start NFS server daemon
# /etc/init.d/nfs.server stop -- To stop NFS server daemon
NFS Server Commands
# share -- To share directory and also displays the contents of the /etc/dfs/sharetab file
# unshare /test -- Unshare the share
# shareall -- Shares all resources listed in the /etc/dfs/dfstab file
# unshareall /export/sys44_data -- Unshare currently shared file resources listed in the
/etc/dfs/sharetab file
# dfshares -- Displays currently shared resources by using the NFS dameon mountd
# dfshares 140.40.40.160 -- Lists available shared resources in remote system
# dfmounts -- Displays a list of NFS resources that are currently mounted and client list
# dfmounts sys42 -- Displays NFS resources of sys42 that are currently mounted & clients
share [-F nfs] [-o options] [-d description] [pathname]
# share –o ro /export/sys44_data -- By default resources available with RW. Access decision is based on a comparison of the UID of the client and the owner.
The Share Command Options
ro Informs clients that the server accepts only read requests
rw Allows the server to accept read and write requests from the client
root=client Informs client that the root user on the specified client system or systems can
perform superuser-privileged requests on the share resource.
ro=access-list Allows read requests from the specified access list
rw=access-list Allows RW requests from the specified access list
Access List Options
access-list=client:client Allows access based on a colon-separated list of clients
access-list=@network Allows access based on a network number (eg @192.168.100
or a network name eg. @mynet.com). The network name must
be defined in the /etc/networks file
access-list=.domain Allows access based on a DNS domain
access-list=netgroup_name Allows access based on a config net group (NIS) or (NIS+)
anon=n Sets n to be the effective user ID (EUID) of anonymous users.
By default, anonumous users are given the EUID 6001-nobody
user. If n is set to –1, access is denied.
# share –F nfs –o r0 direcctory -- Restricts access to read-only access.
# share –F nfs –o r0,rw=client1 directory
-- Restricts access to read-only, however, the NFS server accepts both read & write requests from the client client1
# share –F nfs –o root=client2 directory
-- Allows the root user on the client named client2 to have superuser access to the NFS mounted resources
# share –F nfs –o ro,anon=0 directory
-- By setting the option anon=0, the EUID for access to shared resources by an anonymous user is set to 0. The access is also set to read only.
# share
- /export/sys44_data ro “”
Managing the NFS Client
NFS Client Files
/etc/vfstab Defines FS to be mounted locally
/etc/mnttab Lists currently mounted FS including automounted directories.
/etc/dfs/fstypes Lists the default FS types for remote FS
NFS Client Daemons
The NFS client daemons are started using the /etc/rc2.d/S73nfs.client script
statd Works with the lockd daemon to provide crash recovery functions
lockd Supports record-locking operations on NFS files
/etc/init.d/nfs.client start (or) stop
NFS Client Commands
dfshares Lists available shared resources from a remote or local NFS server
mount Attach a file resource to a specified local mount point
umount Unmounts a currently mounted file resources
mountall Mounts all file resources or a specified group of file resources listed in the
/etc/vfstab file with a mount at boot value of yes
umountall Unmounts all non-critical local and remote file resources
dfmounts Displays a list of currently mounted NFS server directories
mount [-F nfs] [-o options] server:pathname mount-point
# mount sys44:/export/sys44_data /export/remote-data
# mount –o ro sys45,sys43,sys41:/multi_home_data /remote_shared_data
-- When mounting a read-only remote resources, you can specify a comma separated list of sources for the remote resources. Which are then used as a list of failover resources
# umount /export/remote-data -- Unmounting remote FS from the client
# mountall –r -- To limit the action of this command to remote file resources.
# umountall –r -- To unmount all remote file systems
Mounting Remote Resources at Boot Time
Enter appropriate entries in the client’s /etc/vfstab file to mount the remote file resources at boot time.
# vi /etc/vfstab
sys44:/export/sys44_data - /export/remote-data nfs - yes soft,bg
Mount Command Options
rw | ro Read/Write or read-only. The default is read/write
bg | fg Retry to mount in background or foreground. The default is to retry in the foreground soft | hard Soft option reports an error on the request, and stop trying when retrans=n
reach. Whereas hard option prints a warning message and continue to try.
Default is hard mount
intr | nointr Enables or disabled the use of KB interrupts to kill aprocess that hangs on a
hard-mounted FS. The default is intr.
suid | nosuid Indicates whether to enable setuid execution. Default is setuid execution
timeo=n Sets the timeout to n tenth of a second. The default timemout is 11, measures
in one-tenth of a second for UDP and 600 tenths of a second for TCP.
retry=n Sets the no of times to retry the mount operation. Default is 10,000 times
retrans=n Sets the number of NFS retransmission to n. The default is 5 for UDP.
Enabling the NFS Server Logging
nfslogd daemon responsible for NFS logging
The /etc/nfs/nfslog.conf file defines the path, file names, and type of logging that the nfslogd daemon must use. There is a taq corresponding to each definition.
Eg. Of nfslog.conf file
# NFS server log configuration file
global defaultdir=/var/nfs \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
defaultdir=dir_path -- Specifies the default parent directory
log=logfile_pat -- Specifies relative or absolute path and the filename for the ASCII log file
fhtable=table_path -- Specifies path and the filename for the file-handle-to-path DB file
buffer=buffer_path -- Specifies path and the filename for the raw buffer file
log format=basic | extended -- Specifies the format when creating user-redable log files
To easily identify the log files for different shared resources, place them in separate dir. For eg.
# cat /etc/nfs/nfslog.conf
global defaultdir=/var/nfs \
log=nfslog fhtable=fhtable buffer=nfslog-workbuffer
public defaultdir=/var/nfs/public \
log=nfslog fhtable=fhtable buffer=nfslog-workbuffer
Create the /var/nfs/public directory before starting NFS server logging
Specify a tag by entering the tag to use with the log=taq option in the /etc/dfs/dfstab file. Use the log option without specifying a taq, which mean use the default global tag
share –F nfs –o ro,log /export/sys44_date
/etc/default/nfslogd -- The config info file controls the logging behavior of the nfslogd daemon.
No comments:
Post a Comment