---
title: "SUN NFS architecture and operation"
subject: "Distributed System"
chapter: 2
key: "semester_7/distributed_system:sun-nfs-architecture"
source: https://www.bctengineer.com/q/semester_7/distributed_system/sun-nfs-architecture
site: BCT Engineering
---

# SUN NFS architecture and operation

Distributed System · Chapter 2: Distributed Objects and File System

- Asked in: 2072 Chaitra, 2+6 marks; 2071 Shrawan, 3+5 marks; 2069 Chaitra, 3+5 marks (asked 3 times)
- Video: [CS 407 Distributed Computing - Module 4 - SUN NFS](https://www.youtube.com/watch?v=DAZWz04o7RI) — Dept. of Computer Science & Engineering, CCE
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/sun-nfs-architecture
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-2

## Question

Explain the architecture and operation of SUN NFS (Network File System) with its features/properties.

## Short answer

NFS uses a VFS layer to route local or remote requests; the NFS client sends RPC/XDR requests and the server uses a file handle to access the local file system. It is stateless with idempotent operations, caches data for about 3-30 seconds for files, and supports heterogeneity and mounting.

## Answer

**SUN NFS** (Network File System) is the most widely used distributed file service, developed by Sun Microsystems. It lets a client access remote files as if they were local, over an RPC-based protocol that is independent of the operating system, hardware and network.

**Architecture**

```text
 Client computer                       Server computer
 +-----------------------------+       +-----------------------------+
 | Application programs        |       |                             |
 |-------- UNIX kernel --------|       |-------- UNIX kernel --------|
 |    Virtual file system      |       |    Virtual file system      |
 |      |              |       |       |       |              |      |
 | +----v-----+  +-----v-----+ |       | +-----v-----+  +-----v----+ |
 | | UNIX     |  | NFS       | |       | | NFS       |  | UNIX     | |
 | | file     |  | client    | |       | | server    |  | file     | |
 | | system   |  |           | |       | |           |  | system   | |
 | +----------+  +-----+-----+ |       | +-----+-----+  +----------+ |
 +---------------------|-------+       +-------|---------------------+
                       |                       |
                       +<---- NFS protocol --->+
                              (RPC over UDP/TCP)
```

- **Virtual file system (VFS):** a layer in the kernel that decides whether a request is for a local file or a remote file and passes it to the UNIX file system or to the NFS client. It keeps a *v-node* for each open file; the v-node holds an i-node reference for a local file or a *file handle* for a remote file.
- **NFS client:** translates VFS operations into RPC requests to the server.
- **NFS server:** receives requests, identifies the file by its **file handle** (file system id, i-node number, i-node generation number), and calls the local file system.
- **Mount service:** a client mounts a remote directory into its local file tree. The server lists the file systems it exports in /etc/exports, and the client records each mounted remote directory in its mount table.
- **Automounter:** mounts a remote directory on first use.

**Operation**

1. The application issues a system call (for example read).
2. The VFS finds that the file is remote and calls the NFS client.
3. The NFS client sends an RPC (lookup, read, write, getattr, create, remove, mkdir, readdir...) over UDP/TCP using XDR encoding.
4. The NFS server's VFS finds the local file by the file handle, runs the operation on the local file system and returns the result.
5. The client caches the data (block cache) and attributes. Cache validity is checked by comparing timestamps; a cached entry is trusted for a freshness interval of about 3–30 seconds for files and 30–60 seconds for directories.

**Features / properties**

- **Access and location transparency** through mounting.
- **Stateless server:** each request carries all the information needed, so a crashed server restarts without recovery work; operations are idempotent.
- **Heterogeneity:** works with any OS that implements the protocol.
- **Caching:** read-ahead and delayed write for performance, with approximate (not strict one-copy) consistency.
- **Security:** the original version trusted the user id sent in the RPC; later versions use Kerberos.
- **Limited replication and migration support.**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does the Virtual File System (VFS) layer do in NFS?
   A. Decides whether a request is for a local or a remote file and passes it to the UNIX file system or the NFS client
   B. Stores the file data of remote clients on the server
   C. Encrypts all RPC messages between client and server
   D. Mounts remote directories automatically on first use
   Answer: A. The VFS sits in the kernel and routes each request, using v-nodes for local and file handles for remote files. (Key point: Role of VFS)

2. What does the NFS server use to identify a file in a request?
   A. The full path name of the file typed by the user
   B. A session id created when the client opened the file
   C. A file handle made of file system id, i-node number and i-node generation number
   D. The client's IP address and port number
   Answer: C. The file handle uniquely names the file so the server needs no per-client open-file state. (Key point: File handle)

3. Why can a crashed NFS server simply restart without recovery work?
   A. It keeps a log of every client's open files on disk
   B. It is stateless: each request carries all needed information and operations are idempotent
   C. Clients must re-open all files after the restart
   D. It uses callbacks to tell clients what to resend
   Answer: B. Because no client state is held, there is nothing to rebuild; repeated requests are harmless. (Key point: Stateless server)

4. How does an NFS client check that cached data is still valid?
   A. The server sends an invalidation callback on every write
   B. Cached data is never checked and is always trusted
   C. Every read is re-fetched from the server
   D. By timestamp comparison, with a freshness interval (about 3 s for files, 30 s for directories)
   Answer: D. NFS gives only approximate consistency: caches are validated by timestamps after a short interval, not strictly one-copy. (Key point: Client caching consistency)

## Related in Distributed System

- [Need of naming; Sun NFS](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Anaming-nfs) — Distributed System, chapter 2
- [Stateful vs stateless; NFS architecture](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Anfs-stateful-stateless) — Distributed System, chapter 2
- [Stub, skeleton and NFS architecture](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Astub-skeleton-nfs) — Distributed System, chapter 2
- [DFS requirements and file service architecture](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Adfs-requirements-architecture) — Distributed System, chapter 2

## Related in other subjects

- [Google File System architecture](https://www.bctengineer.com/question.md?key=semester_8%2Fbig_data_technologies%3Agfs-architecture) — Big Data Technologies, chapter 2, asked 2×
- [Features of client/server architecture](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Aclient-server-features) — Computer Networks and Security, chapter 1
- [Errors encountered during file operation](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Afile-errors) — Object Oriented Programming, chapter 8
- [X.25 network and features](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Ax25-network) — Computer Networks and Security, chapter 2
