Transcript NFS - SMU
NFS :
Network File System
SMU CSE8343
Prof. Khalil
September 27, 2003
Group 1
Group members:
Payal Patel, Malka Samata,
Wael Faheem, Hazem Morsy, Poramate Ongsakorn
Outline
•
•
•
•
•
•
•
•
•
•
•
•
•
Definition
NFS
OSI v.s. NFS
How does NFS work ?
File Handles
Statelessness
Idempotent procedures
TCP or UDP
How does RPC work ?
How does RPC differ from Local procedure call ?
Port Mapper/RPCBIND
Summary
Reference & Appendix
Definition
• The Network File System (NFS) is a
distributed file system that allows
users to access files and directories
located on remote computers and
treat those files and directories as if
they were local.
• The NFS protocol is designed to be
machine, operating system, network
architecture, and transport protocol
independent.
Several workstations with NFS
rapid.engr.smu.edu
(Ultrix)
buz.engr.smu.edu
(Tru64)
nova.engr.smu.edu
(Solaris)
Ethernet
burn.engr.smu.edu
(Solaris)
DISK
NFS Server
Several workstations with NFS
(Logical view)
rapid:/
etc
home
buz:/
usr
...
etc
home
nova:/
usr
...
etc
burn:/
etc
home
usr
NFS Server's disk:/
...
etc
pongsak
home
hmorsy
usr
wfaheem
...
...
home
usr
...
OSI v.s. NFS
Application
NFS
MOUNT
PORT MAPPER
NIS(Network Information System)
Presentation
XDR (eXternal Data Representation)
Session
RPC (Remote Procedure Call)
Transport
TCP, UDP
Network
IP
Link
Physical
OSI Model
Ethernet
NFS Protocol Layers
Outline
•
•
•
•
•
•
•
•
•
•
•
•
•
Definition
NFS
OSI v.s. NFS
How does NFS work ?
File Handles
Statelessness
Idempotent procedures
TCP or UDP
How does RPC work ?
How does RPC differ from Local procedure call ?
Port Mapper/RPCBIND
Summary
Reference & Appendix
How does NFS work ?
Client wants to access
a file from server
user
process
local
file
access
NFS
client
client kernel
local
disk
local
file
access
NFS
server
RPC
RPC
TCP/UDP
IP
TCP/UDP
IP
port 2049
server kernel
local
disk
File Handles
• How does a server know which
file/directory the client needs to access?
– At first, client obtains a file handle for root of
the file system
– File handle is opaque to the client
– Client sends file handle to server when
referencing a file/directory
– No need to use the full path names
• “The file handle can contain whatever information
the server needs to distinguish an individual file”
Example of File Handles
NFS Client
NFS Server
What is the attribute
of current dir(1000) ?
These are attributes
of 1000
What is FH of "sub2"
in 1000 ?
FH of sub2 is 1100
What is FH of "myname.txt"
in 1100 ?
FH of myname.txt
is 1200
What is the attribute of
1200 ?
Suppose : client needs
to cat the file
sub2/myname.txt
under the current
directory (~/pongsak)
.
.
.
Statelessness
• What is statelessness ?
– Server does not need to maintain protocol state
about it’s client
– Server does not keep previous request
information
– Client keeps track of all information required
to send requests to the server
• Advantage :
– If server crashes, no state information lost
– Client needs only retransmit a request until the
server responds
Why is idempotent important ?
NFS Client
NFS Server
What is the attribute of
1100 (dir sub2) ?
Here is the attr and
content of 1100
Remove "myname.txt"
from 1100
Remove OK
Remove "myname.txt" from
1100 (retransmitted)
Error : No such file or dir
Suppose :
client needs to remove
the file sub2/myname.txt
Idempotent procedures
• Can be executed more than once by the server
and still return the same result
• Stateless protocol requires idempotent
operation
• How to makes all NFS requests idempotent:
– Server records recently performed operations in
cache
– Server checks in cache for duplicate requests
– Server returns the previous result if it is a duplicate
Should NFS use TCP or
UDP ?
• From the beginning, NFS used UDP
– Most NFS systems were on LAN
– High overhead if using TCP
• Currently, NFS across WAN needs TCP
– Reliability and congestion control
– Both sides set TCP’s keep alive option
– If server crashes, client opens new TCP
connection
– If client crashes, server will terminate the
connection after the next keep alive probe
Outline
•
•
•
•
•
•
•
•
•
•
•
•
•
Definition
NFS
OSI v.s. NFS
How does NFS work ?
File Handles
Statelessness
Idempotent procedures
TCP or UDP
How does RPC work ?
How does RPC differ from Local procedure call ?
Port Mapper/RPCBIND
Summary
Reference & Appendix
How does RPC works ?
Client Process
Client
executes
Server Process
RPC
message
Server
waits
Server starts
Procedure call
Server executes
procedure
Client
waits
Client
continues
RPC return
message
Procedure return
Call terminates
How does RPC different from
local procedure call ?
• Error handling:
– failures of the server or network must be
handled
• Global variables:
– arguments cannot be passed as global
variables
• Performance:
– slower than local procedure calls
• Authentication:
– RPC can be transported over insecure
networks
Port Mapper : Analogy
Airport Entrance
Terminal A
Terminal F
US109 to DFW
Terminal D
Terminal E
Terminal C
Terminal B
Port Mapper : Analogy
Airport Entrance
Terminal A
Terminal F
Flight schedule
Flight
US109 to DFW
DE427
US109
US278
UA0097
Terminal D
Terminal C
Terminal B
Departure time Destination Gate
6:15 AM Cincinnati
7:40 AM Akron
DFW TXOH
4:35 PM Detroit MI
6:00 PM LAX
CA
Philadelphia
E8
B5
C9
D12
Terminal E
Port Mapper/RPCBIND
user
process
user
process
Client
Process
Port Mapper
(1)
register
at start
(2) get port# RPC request
(3) RPC reply with port#
(4) RPC call (request)
Client Kernel
(5) RPC reply message
Server Kernel
user
process
Server
Process
Outline
•
•
•
•
•
•
•
•
•
•
•
•
•
Definition
NFS
OSI v.s. NFS
How does NFS work ?
File Handles
Statelessness
Idempotent procedures
TCP or UDP
How does RPC work ?
How does RPC differ from Local procedure call ?
Port Mapper/RPCBIND
Summary
Reference & Appendix
Summary
•
•
•
•
•
•
•
NFS provides transparent file accesses
NFS sends messages in XDR format using RPC
NFS server is stateless
NFS procedures are idempotent
RPC executes remote procedure for clients
Most RPC programs use ephemeral ports
Port Mapper maps RPC programs and version
numbers to port numbers
Reference & Appendix
•
•
•
•
•
•
http://www.faqs.org/rfcs/
http://www.ussg.iu.edu/usail/network/nfs/overview.html
http://www.scit.wlv.ac.uk/~jphb/comms/nfs.html
http://www.opengroup.org/onlinepubs/9629399/chap1.htm
http://msdn.microsoft.com/library/default.asp?url=/library/en
-us/rpc/rpc/rpc_start_page.asp
http://www.cis.udel.edu/~srisath/NFS/index.html
•
•
Silberschatz/Galvin/Gagne, Operating System Concepts, Wiley
William Stallings, Operating Systems, Prentice Hall
RFC Documents
Request For Comments
•
•
•
•
•
•
•
•
RFC 1014 – XDR (1987)
RFC 1057 – RPCv2 (1988)
RFC 1094 - NFSv2 (1989)
RFC 1813 - NFSv3 (1995)
RFC 2054 - WebNFS (1996)
RFC 2624 - NFSv4 (1999)
RFC 3010 - NFSv4 Protocol (2000)
RFC 3530 - NFSv4 Protocol (2003)
http://www.faqs.org/rfcs/
NFS v2
•
•
•
•
•
18 ops
File sizes limited to 32 bit
Slow writes
Arbitrary transfer limit
Lack of cache consistency
NFS v3
•
•
•
•
•
22 ops
File size extended to 64 bit
Fast write
Increased transfer write
Support caching and ACLs
WebNFS
• Eliminate overhead of PORTMAP
and MOUNT
• Possible for firewall transit
• Reduce number of LOOKUP
request
NFS v4
•
•
•
•
Internet
Need for cross platform support
Strong security
Design for growth
NFS procedures
NFS
Procedures
LOOKUP
MKDIR
RMDIR
READDIR
RENAME
REMOVE
CREATE
READ
WRITE
GETATTR
SETATTR
LINK
SYMLINK
READLINK
STATFS
Functions
Returns a file handle and attribute corresponding to a file name in a specified directory.
Create a directory.
Delete a directory.
Read a directory. Used by the Unix ls command, for example.
Rename a file.
Delete a file.
Create a file.
Read from a file, by specify the file handle, starting offset and max. no. of bytes to read
(up to 8192).
Write to a file.
Returns the attributes of a file: type of file, permissions, size, owner, last-access time,
and so on.
Set the attributes of a file: permissions, owner, group, size,and last-access and lastmodification time.
Create a Unix hard link to a file.
Create a symbolic link to a file.
Returns the name of the file to whidh the symbolic link points.
Returns the status of a file system. Used by the Unix df command, for example.
Format of RPC call
IP header
common for all
Sun RPC
procedure call
depends on specific
procedure being
called
20 bytes
UDP header
8
Transaction ID (XID)
Send direction (0)
RPC version (2)
Program number
Version number
Procedure number
4
4
4
4
4
4
Credentials
up to 408 bytes
Verifier
up to 408 bytes
Procedure call parameters
N
Format of RPC reply
IP header
common for all
Sun RPC
procedure
depends on
specific procedure
20 bytes
UDP header
8
Transaction ID (XID)
Send direction (1)
Status (0=accepted)
4
4
4
Verifier
up to 400 bytes
Accept status (0=success)
4
Procedure results
N
Questions and
Comments
Thank You!