NFS – Network File System WeeSan Lee
Roadmap Introduction How to setup a NFS server? How to setup a NFS client? nfsstat Automatic Mounting Q&A
Introduction Created by Sun in 1985 Was original designed for diskless clients Version 2 is slow Write operation is not complete until receiving ACK from the server Version 3 permits async writes Faster Version 4 Supports strong security, ACLs, unicode filenames, replication and migration, etc
Introduction (cont) Uses RPC Remote Procedure Call – a system-independent way for process communication over a network Could be UDP and TCP Now, TCP is preferable
How to setup a NFS server? /etc/exports $ cat /etc/exports /home /24(rw,async,root_squash) /home/ftp(noaccess) /import /24(ro) $ exportfs -a /etc/hosts.allow $ cat /etc/hosts.allow portmap: / mountd: / Map root UID & GID to nobody
How to setup a NFS server? (cont) /etc/init.d/nfs {start|stop|restart|reload|status} portmap rpc.statd nfsd rpc.mountd rpc.rquotad Turns NFS on over reboot $ chkconfig nfs on
How to setup a NFS client? /etc/init.d/portmap start portmap rpc.statd Manual mount the NFS partitions $ mount :/home /home $ mount :/import /import Mount the NFS partitions at boot time $ cat /etc/fstab :/home/homenfsdefaults :/import/importnfsdefaults 0 0 $ mount -a
How to setup a NFS client? (cont) Experiment defaults with soft,timeo=5 hard,intr To umount a NFS partition $ umount /home To show the NFS server's export list $ showmount -e
nfsstat Displays stats. about NFS server and client For server $ nfsstat -s For client $ nfsstat -c
Automatic Mouting Mount filesystems on-demand Originally comes from Sun To start $ /etc/init.d/autofs start Master map file (/etc/auto.master) Associates each mount point with a indirect map $ cat /etc/auto.master /misc/etc/auto.misc /net-host
Automatic Mouting (cont) To automount /home & /import Add the following lines into /etc/auto.master /home/etc/auto.home /import/etc/auto.import $ cat /etc/auto.home *-soft,timeo= :/home/& $cat /etc/auto.import *-soft,timeo= :/import/&
Reference LAH Ch 16: The Network File System