140 likes | 283 Views
NFS – Network File System. WeeSan Lee <weesan@cs.ucr.edu> http://www.cs.ucr.edu/~weesan/. 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
E N D
NFS – Network File System WeeSan Lee <weesan@cs.ucr.edu> http://www.cs.ucr.edu/~weesan/
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? Map root UID & GID to nobody • /etc/exports • $ cat /etc/exports • /home 10.0.0.0/24(rw,async,root_squash) • /home/ftp (noaccess) • /import 10.0.0.0/24(ro) • $ exportfs -a • /etc/hosts.allow • $ cat /etc/hosts.allow • portmap: 10.0.0.0/255.255.255.0 • mountd: 10.0.0.0/255.255.255.0
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 10.0.0.1:/home /home • $ mount 10.0.0.1:/import /import • Mount the NFS partitions at boot time • $ cat /etc/fstab • 10.0.0.1:/home /home nfs defaults 0 0 • 10.0.0.1:/import /import nfs defaults 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 10.0.0.1
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=5 10.0.0.1:/home/& • $cat /etc/auto.import • * -soft,timeo=5 10.0.0.1:/import/&
Reference • LAH • Ch 16: The Network File System