Friday, January 11, 2008

Network file system(NFS)

NFS provides shared access to files and directories(shares which have been exported by the server).NFS share can be mounted by a client system in the same way local file system is mounted.
NFS server runs 3 NFS related daemons:
1.portmap,which forwards client requests to the correct nfs process.
2.rpc.nfsd,translates remote file access e\request to a local file access request.
3.rpc.mounted,mounts and unmounts file systems.
To use NFS we need 2 packages:
1.nfs-utils,contain utilities needed for using NFS.
2.portmap,contain file relates to portmap.

Server configuration

The NFS server configuration file is /etc/exports, each line of directives specify a share and associate access permissions.The general form of directive is:

absolute_path host_list (rw,sync,no_root_squash)
/export/database 192.168.10.115 (rw,sync,no_root_squash)

Host_list is a list of one or more hosts which can access the shares.Each host should be separated by a space.Wild card(*) can be used to match part of the host name or file name.By default clients are permitted read only(ro) access,to allow read-write access follow the host specifier with(rw).By default client is logged in as root,to permit root access,specify no_root_squash option.

service nfs restart
service nfs stop

exportfs -v lists shared directories
exportfs -a export all shares listed in /etc/exports
ecportfs -ua unexports all shares
exportfs -r refreshes the share list

Client configuration

shared directory can mounted in this way:
mount nfs_server:/exports/database /mnt
mount 192.168.10.108:/exports/database /mnt

We can also mount the NFS share in the boot time:
192.168.10.108:/exports/database /mnt nfs defaults 0 2

NFS administration

To check the status of the NFS server:
service nfs status

To check the status of a remote NFS server:
rpcinfo -p 192.168.10.115

To list the shares exported by a server:
showmount -e 192.168.10.115

No comments: