NFS Server and client

NFS Server

The Solaris 10 OS the default is to use NFSv4

NFS Server Files

File Description
/etc/dfs/dfstab Lists the local resources to share at boot time.
/etc/dfs/sharetab Lists the local resources currently being shared by the NFS server. Do not edit this file.
/etc/dfs/fstypes Lists the default file system types for remote file systems.
/etc/rmtab Lists file systems remotely mounted by NFS clients. Do not edit this file.
/etc/nfs/nfslog.conf Lists information defining the location of configuration logs used for NFS server logging.
/etc/default/nfslogd Lists configuration information describing the behavior of the nfslogd daemon for NFSv2/3.
/etc/default/nfs Contains parameter values for NFS protocols and NFS daemons.
# cat /etc/dfs/fstypes
nfs NFS Utilities
autofs AUTOFS Utilities
cachefs CACHEFS Utilities
# cat /etc/rmtab
sys-03:/usr/local/data
sys-02:/export/config
#ys-02:/export/config
Solaris 10
# svcadm -v enable nfs/server
svc:/network/nfs/server:default enabled

# svcadm disable svc:/network/nfs/server

Solaris 7 & 8 & 9

/etc/init.d/nfs.server stop/start/status

The mountd daemon checks the /etc/dfs/sharetab file to determine whether a particular file or directory is being shared and whether the requesting client has
permission to access the shared resource

Commands Description
share Makes a local directory on an NFS server available for mounting. It also displays the contents of the /etc/dfs/sharetab file.
unshare Makes a previously available directory unavailable for client side mount operations.
shareall Reads and executes share statements in the /etc/dfs/dfstab file.
unshareall Makes previously shared resources unavailable.
dfshares Lists available shared resources from a remote or local NFS server.
dfmounts Displays a list of NFS server directories that are currently mounted.

showmount -e —->

share [ -F nfs ] [ -o options ] [ -d description ] [ pathname ]

Where

-F nfs Specifies the file system type. This option is not typically required, because NFS is the default remote file system type.
-o options Controls a client’s access to an NFS shared resource.
-d description Describes the shared file resource.
pathname Specifies the absolute path name of the resource for sharing.

Example

# share -o ro /usr/local/data
# share -F nfs -o ro directory
# share -F nfs -o ro,rw=client1 directory

# share -F nfs -o ro=client1:client2,rw=client3:client4,root=client4 directory

unshare [ -F nfs ] pathname

where:
-F nfs Specifies NFS as the file system type. Because NFS is the default remote file system type, you do not have to specify this option.
pathname Specifies the path name of the file resource to unshare.

Example

# unshare /usr/local/data

# share -F nfs -o ro /usr/local/data
# dfshares
RESOURCE SERVER ACCESS TRANSPORT
sys-02:/usr/local/data sys-02 – –

# dfmounts
RESOURCE SERVER PATHNAME CLIENTS
– sys-02 /usr/local/data sys-03


NFS Client

NFS Client Files

File Description
/etc/vfstab Defines file systems to be mounted locally.
/etc/mnttab Lists currently mounted file systems, including automounted directories. The contents of this file are maintained by the kernel and cannot be edited.
/etc/dfs/fstypes Lists the default file system types for remote file ystems.
/etc/default/nfs Contains parameters used by NFS protocols and daemons.

To mount remote file resources at boot time, enter the appropriate entries in the client’s /etc/vfstab

#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
sys-02:/usr/local/data – /usr/remote_data nfs – yes soft,bg

The lockd daemon is started by the SMF service nfs/nlockmgr.
# svcadm -v enable nfs/nlockmgr
svc:/network/nfs/nlockmgr:default enabled.

The statd daemon is started by the SMF service nfs/status.
# svcadm -v enable nfs/status
svc:/network/nfs/status:default enabled.

To manually restart

# svcadm -v restart nfs/status
Action restart set for svc:/network/nfs/status:default.
# svcadm -v restart nfs/nlockmgr
Action restart set for svc:/network/nfs/nlockmgr:default.

NFS Client Commands

Command Description
dfshares Lists available shared resources from a remote or local NFS server
mount Attaches a file resource (local or remote) to a specified local mount point
umount Unmounts a currently mounted file resource
mountall Mounts all file resources or a specific 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

mount [ -F nfs ] [ -o options ] server:pathname mount_point
To limit the action of this command to remote file resources, use the -r option.

mountall -r [ -F nfs ]

# mountall -r

umountall -r [ -F nfs ]
# umountall -r

NFS issues