Network File System
Basic
The Network File System (NFS) is a client/server application that lets a computer user view and optionally store and update files on a remote computer as though they were on the user’s own computer. NFS is a distributed file system(DFS).
Client/server architecture
Advantage
- Easy sharing of data across clients
- Centralized administration
- Security
Disadvantage:
- Network overhead
- More components to fail
DFS
Architecture
Stateless - 无状态协议
- Server does not keep track of states of clients
- Which files are currently open at which clients
- Current position/offset of file
- Which clients have read/cached which blocks
- Requests from clients must make sure:
- the server can deliver all the information needed to complete the requests
- do not rely on previous requests
file handle
- Volume (file system) identifier
- Which volume? (e.g. partition C or D if NTFS)
- Inode number
- Which file in the volume?
- Generation number
- Needed since inode number may be reused at the server (e.g., after file has been deleted by other clients)
Client uses file handle to communication with server
RPC - Remote procedure call
- Remote server publishes a set of procedures, for example f(args)
- example: NFSPROC_LOOKUP for lookup file handle ,read, write, create, remove, etc.
- In making RPC calls,(客户端调用)
- Client notifies remote server of executing f & sends over arguments args for f
- Server executes f(args) => results
- Server sends back results
Operations on remote file
All CRUD operations use file handle
Read
First obtain file handle via lookup
- File handle for the root directory may be obtained via the mount protocol
1 |
|
Then use file handle to read data
1 |
|
Write
First obtain file handle via lookup
Then use file handle to write data
1 |
|
Create
1 |
|
Remove
1 |
|
Failures
Cases
Case1: request lost
Case2: Server down
Case3: Reply lost on way back from Sever
More details
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!