Chapter 17 The Network File System. Computer Center, CS, NCTU 2 NFS  Share filesystem to other hosts via network  NFS History Introduced by Sun Microsystems.

Slides:



Advertisements
Similar presentations
1 Dynamic DNS. 2 Module - Dynamic DNS ♦ Overview The domain names and IP addresses of hosts and the devices may change for many reasons. This module focuses.
Advertisements

1 UNIX Internals – the New Frontiers Distributed File Systems.
Homework 5b: Samba. Computer Center, CS, NCTU 2 Network-based File Sharing (1)  NFS (UNIX-based) mountd is responsible for mount request nfsd and nfsiod.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File-System Interface.
70-293: MCSE Guide to Planning a Microsoft Windows Server 2003 Network, Enhanced Chapter 7: Planning a DNS Strategy.
NFS. The Sun Network File System (NFS) An implementation and a specification of a software system for accessing remote files across LANs. The implementation.
1 DNS,NFS & RPC Rizwan Rehman, CCS, DU. Netprog: DNS and name lookups 2 Hostnames IP Addresses are great for computers –IP address includes information.
Network File Sharing Chapter 18. Chapter Goals Understand concepts of network file sharing Understand NFS server setup Understand NFS client setup Understand.
NETWORK FILE SYSTEM (NFS) By Ameeta.Jakate. NFS NFS was introduced in 1985 as a means of providing transparent access to remote file systems. NFS Architecture.
NFS – Network File System WeeSan Lee
Network File System Joe Paulowskey Joe Paulowskey Susan Mulholland Joe Woulfe.
Network File System CIS 238. NFS (Network File System) The most commercially successful and widely available remote file system protocol Designed and.
Joshua Caltagirone-Holzli
1 Network File System. 2 Network Services A Linux system starts some services at boot time and allow other services to be started up when necessary. These.
Remote Disk Access with NFS
File Systems (2). Readings r Silbershatz et al: 11.8.
DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM R. Sandberg, D. Goldberg S. Kleinman, D. Walsh, R. Lyon Sun Microsystems.
Distributed File Systems Concepts & Overview. Goals and Criteria Goal: present to a user a coherent, efficient, and manageable system for long-term data.
Linux Installation and Administration – Lesson 5 Tutor: George Papamarkos Topic: Devices in Linux.
Networked File System CS Introduction to Operating Systems.
1 Network File Sharing. 2 Module - Network File Sharing ♦ Overview This module focuses on configuring Network File System (NFS) for servers and clients.
Final Project – NFS and NIS jwbai. Computer Center, CS, NCTU 2 Goal master.passwd passwd group netgroup amd.conf userA, /nis/home/userA userB, /nis/home/userB.
1 COP 4343 Unix System Administration Unit 15: file server – ftp – nfs.
70-291: MCSE Guide to Managing a Microsoft Windows Server 2003 Network Chapter 7: Domain Name System.
New SA Training Topic 8: File System Access  Our organization uses a variety of services for accessing files on remote systems  WWW  FTP  CIFS/SMB.
Automating File Sharing Chapter 19. Chapter Goals Understand how to automount file systems under Windows. Understand how to create a consistent name space.
Distributed File Systems Objectives –to understand Unix network file sharing Contents –Installing NFS –How To Get NFS Started –The /etc/exports File –Activating.
Hour 7 The Application Layer 1. What Is the Application Layer? The Application layer is the top layer in TCP/IP's protocol suite Some of the components.
Sys Admin Course NFS and SAMBA Fourie Joubert. Sys Admin Course NFS NFS is the Network File System It allows Linux systems to share a file system, or.
NFS : Network File System SMU CSE8343 Prof. Khalil September 27, 2003 Group 1 Group members: Payal Patel, Malka Samata, Wael Faheem, Hazem Morsy, Poramate.
Automount NFS. Computer Center, CS, NCTU 2 Automatic mounting  Problems of /etc/fstab Maintenance of /etc/fstab in large network Crashed NFS server will.
1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file.
Network File System Campus-Booster ID : **XXXXX Copyright © SUPINFO. All rights reserved NFS.
NFS Network File System. NFS (Network File System) Network file systems allow us to share files between users on different systems, often with different.
Distributed File Systems Objectives –to understand Unix network file sharing Contents –Installing NFS –How To Get NFS Started –The /etc/exports File –Activating.
Exercise 4 – NFS and NIS Announced Date: 2007/12/11 Due Date: 2007/12/25.
Sun Network File System Presentation 3 Group A4 Sean Hudson, Syeda Taib, Manasi Kapadia.
CS 346 – Chapter 11 File system –Files –Access –Directories –Mounting –Sharing –Protection.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
System Administration HW5 - Micro Computer Center yihshih / lctseng.
EE324 INTRO TO DISTRIBUTED SYSTEMS. Distributed File System  What is a file system?
The Network File System
COT 4600 Operating Systems Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM.
Distributed File Systems Questions answered in this lecture: Why are distributed file systems useful? What is difficult about distributed file systems?
Distributed Systems: Distributed File Systems Ghada Ahmed, PhD. Assistant Prof., Computer Science Dept. Web:
The Network File System
LINUX ADMINISTRATION
Chapter 17 The Network File System
Automount NFS.
The Network File System
IS3440 Linux Security Unit 4 Securing the Linux Filesystem
NFS.
Final Project Announce: Due:
Automount NFS.
CIT 470: Advanced Network and System Administration
DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM
The Network File System
Automount NFS.
Chapter 15: File System Internals
Today: Distributed File Systems
Chapter 17 The Network File System
The Network File System
The Network File System
The Network File System
Automounter Filesystem - autofs
The Network File System
Automount NFS.
Network File System (NFS)
Presentation transcript:

Chapter 17 The Network File System

Computer Center, CS, NCTU 2 NFS  Share filesystem to other hosts via network  NFS History Introduced by Sun Microsystems in 1985 Originally designed for diskless client-server architecture

Computer Center, CS, NCTU 3 Components of NFS  Including Mounting Protocol Mount Server Daemons that coordinate basic file service Diagnostic utilities

Computer Center, CS, NCTU 4 Components of NFS – mounting protocol (1)  NFSv2 Synchronous write V2 NFS server must commit each modified block to disk before replying to NFS client Cause long delay when there is a NFS write operation  NFSv3 in 1990s Asynchronous write Provide increase performance and better support for large files

Computer Center, CS, NCTU 5 Components of NFS – mounting protocol (2)  Sun ’ s ONC distributed computing standards NFS client  RPC  Transport Layer  … Transport Layer  UDP: Lack congestion control  TCP: become more suitable

Computer Center, CS, NCTU 6 Components of NFS – mounting protocol (3)  Advanced NFS feature support by OS SystemNFSv3TCPDefault FreeBSDYes UDP Linux (debian)Yes UDP SolarisYes TCP SunOSNo UDP

Computer Center, CS, NCTU 7 Components of NFS – Server-side NFS (1)  NFS Server Export sharing filesystem  System dependent Waiting for “mount request”  mountd (rpc.mountd) daemon Waiting for “file access request”  nfsd (rpc.nfsd) daemon

Computer Center, CS, NCTU 8 Components of NFS – Server-side NFS (2)  Exporting filesystem 1.Edit export configuration file  Each line is “ what to export and how ” 2.Reload related daemons SystemExports info fileHow to reload FreeBSD/etc/exports kill -1 Linux/etc/exports/usr/sbin/exportfs -a Solaris/etc/dfs/dfstab/usr/sbin/shareall SunOS/etc/exports/usr/sbin/exportfs -a

Computer Center, CS, NCTU 9 Components of NFS – Server-side NFS (FreeBSD.1)  Exporting filesystem /etc/exports  White-space separated directory-list options-list client-list  Format: directory-list options-list client-list OptionDescription -roExports read-only, default is (read-write) -alldirsAllow any subdirectory to be mounted -maproot=userMaps root to the specified user. -mapall=userMaps all UIDs to the specified user. ClientDescription hostnameHost name (ex: mailgate ccserv) netgroupNIS netgroups -network -mask-network mask

Computer Center, CS, NCTU 10 Components of NFS – Server-side NFS (FreeBSD.2)  Example of /etc/exports Network and mask cannot appear on the same line with hosts and netgroups  Reload daemons % kill -1 `cat /var/run/mountd.pid` /etc/rc.d/mountd restart /raid-alldirs –maproot=root mailgate ccserv backup /raid -alldirs –maproot=65534 –network –mask /home-ro –mapall=nobody –network –mask /usr/src /usr/obj –maproot=0 bsd_cc_csie

Computer Center, CS, NCTU 11 Components of NFS – Server-side NFS (Linux.1)  Exporting filesystem /etc/exports directory client-list-with-option  Format: directory client-list-with-option  Ex: /home1 ccbsd5(ro) ClientDescription hostnameHost name (ex: mailgate netgroups ipaddr/maskCIDR-style specification (ex: /24) Wild cards * ?FQND with wild cards (ex: ccbsd*.csie.nctu.edu.tw)

Computer Center, CS, NCTU 12 Components of NFS – Server-side NFS (Linux.2) OptionDescription ro,rwRead-only, Read-write (default) rw=listHosts in the list can do rw, others ro only root_squashMaps UID 0 and GID 0 to the value of anonuid and anongid (default) no_root_squashAllow root access all_squashMaps all UID and GID to anonymous one subtree_checkCheck that the accessed file is in the appropriate filesystem and in the exported tree. no_subtree_checkDisables subtree checking anonuid=xxxRelated to root_squash anongid=xxxRelated to root_squash secureRequire remote access from privileged port insecureAllow remote access from any port noaccess Prevent access to this dir and it ’ s subdir

Computer Center, CS, NCTU 13 Components of NFS – Server-side NFS (Linux.3)  Example of /etc/exports  Run /usr/sbin/exportfs % /usr/sbin/exportfs –a  Maintain /var/lib/nfs/xtab table which is read by mountd /home1ccsun*.csie.nctu.eud.tw(rw) dragon(rw,no_root_squash) /homeccpc1(rw,all_squash,anonuid=150,anongid=100) /ftp/pub(ro,insecure,all_squash) /users*.xor.com(rw) /users/evi(noaccess)

Computer Center, CS, NCTU 14 Components of NFS – Server-side NFS (Solaris.1)  Exporting filesystem /etc/dfs/dfstab Each line will execute “share” command to export one NFS  [format] share – F nfs – o option-list directory  Ex: share – F nfs – o rw=ccbsd5.csie.nctu.edu.tw /home2  Run shareall command % /usr/sbin/shareall ClientDescription hostnameHost name (ex: mailgate ccserv) netgroupNIS netgroups IP specification DNS domains.xxx.yyy any host within the domain (ex:.nctu.edu.tw)

Computer Center, CS, NCTU 15 Components of NFS – Server-side NFS (Solaris.2) OptionDescription ro,rwRead-only to all, Read-write to all ro=list, rw=listHosts in the list can do ro/rw root=list Lists hosts permitted to access this filesystem as root. Otherwise, root access from a client is equivalent to by “ nobody ” anon=xxx Specify the UID to which root is remapped. Default is “ nobody ” anongid=xxxRelated to root_squash nosubForbids clients to mount subdirectories nosuidPrevents setuid and setgid from being created

Computer Center, CS, NCTU 16 Components of NFS – Server-side NFS (3)  nfsd daemon Handle NFS file access request from NFS clients Number of nfsd is important  Too small, some NFS request may be not served  Too large, load will be high  In FreeBSD Specify nfsd options in /etc/rc.conf  nfs_server_enable= “ YES ”  nfs_server_flags= “ -u – t – n 4 ”

Computer Center, CS, NCTU 17 Components of NFS – client-side NFS (1)  NFS Client Mount NFS filesystem first Access file under NFS filesystem  mount command [format]  mount [-o options] host:directory mount-point Ex:  % mount –t nfs ccbsd4:/home/www /home/nfs/www  /etc/fstab (/etc/vfstab in Solaris)  % mount –a –t nfs (FreeBSD, Linux)  % mount –a –F nfs (Solaris)  Aborting 20-hour simulation after running for 18 hours due to transient network glitch # DeviceMountpointFStype Options Dump Pass# dragon:/usr/man/usr/mannfs ro,bg,soft 0 0 ccserv:/spool/mail/var/mailnfs rw,bg,intr 0 0

Computer Center, CS, NCTU 18 Components of NFS – client-side NFS (2)  NFS mount flags FlagSystemsDescription ro or rwS,L,FMount the NFS as ro or rw bgS,L,FIf failed, keep trying in background hardS,LIf server down, access will keep trying until server comes back softS,L,FIf server down, let access fail and return error intr, nointrS,L,FAllow/Disallow user to interrupt blocked access retrans=nS,L,F# of times to repeat a request before error return timeo=nS,L,FTimeout period of requests (tens of seconds) rsize=nS,L,FSet read buffer size to n bytes wsize=nS,L,FSet write buffer size to n bytes vers=nSSelects NFS v2 or v3 nfsv3,nfsv2FSelects NFS v2 or v3 proto=protStcp or udp tcpL,FSelect TCP. UDP is default

Computer Center, CS, NCTU 19 Components of NFS – client-side NFS (3)  Client side daemons that enhance performance biod (block I/O daemon, or called nfsiod) Perform read-ahead and write-behind caching

Computer Center, CS, NCTU 20 Components of NFS – NFS Utilities (1)  nfsstat Display NFS statistics  % nfsstat – s (display statistics of NFS server)  % nfsstat – c (display statistics of NFS client) csduty [/u/dcs/94/ ] -chwong- nfsstat -c Client Info: Rpc Counts: Getattr Setattr Lookup Readlink Read Write Create Remove Rename Link Symlink Mkdir Rmdir Readdir RdirPlus Access Mknod Fsstat Fsinfo PathConf Commit Rpc Info: TimedOut Invalid X Replies Retries Requests Cache Info: Attr Hits Misses Lkup Hits Misses BioR Hits Misses BioW Hits Misses BioRLHits Misses BioD Hits Misses DirE Hits Misses

Computer Center, CS, NCTU 21 Components of NFS – NFS Utilities (2)  showmount % showmount –e cchome  show the hosts ’ s export list % showmount –a  List all mount points magpie [/u/dcs/94/ ] -chwong- showmount -e magpie Exports list on magpie: /homeccduty mailgate /drongooperator ccduty mailgate cshome [/u/dcs/94/ ] -chwong- showmount -a All mount points on localhost: bsd1:/home2 bsd1:/raid/home csduty:/home2 csduty:/raid/home linux1:/raid/home linux2:/raid/home nat235.dynamic:/raid/home sun1:/raid/home

Computer Center, CS, NCTU 22 NFS in FreeBSD  NFS server Edit /etc/rc.conf  NFS client … nfs_server_enable="YES" nfs_server_flags="-u –t –n 4" … nfs_client_enable="YES" …

Computer Center, CS, NCTU 23 Automatic mounting  Problems of /etc/fstab Maintenance of /etc/fstab in large network Crashed NFS server will make operation blocked  automount daemon Mount filesystems when they are referenced and unmount them when they are no longer needed Supply a list of replicated filesystems to replace important but crashed NFS servers Transparent to users  Products automount (from SUN Micro), simple and concise amd (from Jan-Simon Pendry), complicated but more powerful

Computer Center, CS, NCTU 24 automount (1)  Three kinds of configuration files (map) Direct map Indirect map Master map  List which direct and indirect maps that automount should pay attention to Difference between direct and indirect  All mount points in indirect map has common directory defined in master map Provide information about filesystems that are to be automounted

Computer Center, CS, NCTU 25 automount (2)  Example of automount maps /net /etc/auto.net-rw, intr /-/etc/auto.direct-ro, intr WWW-rw,soft,nosuid,vers=2vega:/home/www mail-rw,soft,nosuid,quotaccserv:/spool/mail ftp-ro,soft,nosuidftp:/home/ftp /vlsi/vlsi1-rw,soft,nosuidscorpio:/vlsi1 /vlsi/vlsi2-rw,soft,nosuidscorpio:/vlsi2 master indirect direct

Computer Center, CS, NCTU 26 automount (3)  Master map /etc/auto.master(Linux) /etc/auto_master(Solaris)  Restart automounter when you change the maps /etc/init.d/autofs {start|stop}(Solairs) /etc/init.d/autofs {start|stop|reload|status}(Linux)

Computer Center, CS, NCTU 27 automount (4)  Replicated filesystem There are several identical NFS and I would like to mount anyone of them Constrain  Read-only  These replicated filesystem should be truly identical Automounter will choose a server based on its own idea of which one is the best /usr/man-rochimchim:/usr/man band(1):/usr/man /www/data-roccbsd4,altair:/www/data

Computer Center, CS, NCTU 28 automount (5)  Automatic automounts automount can query the mountd to find out what filesystems the server exports Using –host as map name in the master map file -host does not enumerate all possible hosts  It waits for individual subdirectory names to be referenced  If chimchim exports /usr/share/man –Automount at the path /net/chimchim/usr/share/man /net-host-nosuid,soft

Computer Center, CS, NCTU 29 amd (1)  Advantages over automount Sends “keep alive” queries to remote servers at regular intervals and maintains a list of servers that are accessible  Return an “operation would block” rather than hanging Not proprietary source code Offer another mount types that are not supported by automount  union Map syntax is more generic Provide a query-and-manipulation tool, amq …

Computer Center, CS, NCTU 30 amd (2)  Flexible map syntax One map used by many machines Contain conditions that control which parts of map entry are activate  Selector variable /defaultstype:=nfs;fs:=${autodir}/${key};opts:=nfsv3,rw, \ grpid,quota,intr,soft,nodev,nosuid,resvport, \ timeo=10,retrans=5,nqnfs mailrhost:=ccserv;rfs:=/spool/mail ftprhost:=ftp;rfs:=/home/ftp raid1host==cchome;type:=ufs;dev:=/dev/da0s1e\ host!=cchome;type:=nfs;rhost:=cchome;rfs:=/${key};\ opts:=nfsv3,rw,soft,nosuid,resvport drongohost==magpie;type:=link;fs:=/${key} \ host!=magpie;type:=nfs;rhost:=magpie;rfs:=/${key}

Computer Center, CS, NCTU 31 amd (3) SelectorDescription archArchitecture of the current machine autodirDefault directory under which to mount filesystems domainLocal NIS domain name hostLocal hostname keyVolume name being resolved mapName of mount map being used osOperating System OptionDescription rhostRemote host on which the volume lives rfsRemote filesystem name typeType of mount, nfs or ufs (local disk) fsLocal mount point optsMount options remoptsOptions to use if server is nonlocal

Computer Center, CS, NCTU 32 amd (4)  Starting amd % amd –a /tmp_mnt –l syslog –x fatal, error, user /net auto.home  Stopping amd % kill -15 optionsDescription -x Sets run-time logging options, such as fatal, error, user, warn, info, … -rRestart existing mounts -l Log file name or “ syslog ” -aSpecify alternative location for mount points /netSets the automount directory auto.homeThe map files

Computer Center, CS, NCTU 33 amd (5)  Remount without kill amd Unmount such mounted partition  % umount /amd/magpie Delete such virtual /net/DIR  % rm /net/magpie cd /net/DIR  % cd /net/magpie  amd in FreeBSD Edit rc.conf … amd_enable=“YES” amd_flags=“-a /amd –d csie.nctu.edu.tw –l /var/log/amd.log –x all /net auto.home” …