The idea: does the client ask for a file or for blocks?

Network storage puts the disk on another machine. There are two ways to ask it for data. With file-level storage (NFS, SMB) the client says "give me bytes 0 to 8191 of /data/report.csv". The server runs the filesystem: it knows the names, the inodes, which blocks are free, and who holds a lock. With block-level storage (iSCSI, NVMe over Fabrics) the client says "give me 16 blocks starting at LBA 16384". The client runs the filesystem, and the server only stores numbered blocks.

Two stacks side by side. Left, file level: the client has an app, VFS and an NFS client; the request on the wire is OPEN report.csv and READ offset 0, 8192; the server has nfsd, the XFS filesystem (orange, owns names, inodes, free map, locks) and the SSD. Right, block level: the client has an app, VFS, the ext4 filesystem (orange) and an iSCSI or NVMe driver; the request on the wire is READ LBA 16384, 16 blocks; the server has a target and the SSD with no filesystem.
The same disk either way; what moves is the filesystem (orange): on the server for NFS and SMB, on the client for iSCSI and NVMe-oF.

On the canvas client A's app reads /data/report.csv (16 KB) 8 KB at a time. It opens the file with O_DIRECT, so no page cache hides a read and every read goes to the network. The server has one SSD, drawn as five cells of 512-byte LBAs: the inode-table block at LBA 8200, the two halves of the file at 16384 and 16400, and two free blocks. Every message flies as a box and is written into the wire trace in the middle. The header counts round trips, messages and time for the current read; the table at the bottom keeps the result of each protocol.

File level: NFSv4.1 and SMB3

An NFSv4.1 client sends COMPOUND requests over TCP port 2049: several operations in one message. To read a file it first needs an OPEN, which returns a stateid, then it sends READ with that stateid, an offset and a count. The file is named by a file handle (here 0x5A), never by an inode number or block. On the server, nfsd passes the request to its own filesystem (XFS), which looks up the name, reads the inode from the SSD, maps the byte range to blocks and reads them. The server also keeps the open and lock state for every client. (Demo 1)

SMB3, the Windows protocol on TCP port 445, works the same way, with other names:

stepNFSv4.1SMB 3
open a file by nameOPEN (in a COMPOUND), returns a stateidSMB2 CREATE, returns a FileId
read a byte rangeREAD stateid, offset, countSMB2 READ FileId, offset, length
lock a rangeLOCKSMB2 LOCK
let one client cachedelegationoplock / lease

Block level: iSCSI

iSCSI carries SCSI commands over TCP port 3260. The server is a target with a name like iqn.2026-11.com.example:store; it exports a LUN (logical unit) that the client sees as a local disk, /dev/sdb. The client formats it with its own filesystem (ext4 here). To read the file, ext4 first needs the file's inode, so it asks for the inode-table block itself: the SCSI disk driver builds a READ(10) command (an LBA and a length in blocks) and the initiator wraps it in a SCSI Command PDU. The target answers with a Data-In PDU; its S bit says the status (GOOD) rides along, so no separate SCSI Response PDU is sent. Then ext4 reads the inode's extent, works out that bytes 0–8191 are LBA 16384, and sends a second READ(10). (Demo 2)

NVMe over Fabrics: queues over TCP or RDMA

A local NVMe SSD is driven through queue pairs in memory: the host writes a command into a submission queue (SQ) and the drive writes a result into a completion queue (CQ). NVMe over Fabrics keeps exactly that model and sends the queue entries over a network as capsules. The server exposes a subsystem (named by an NQN) with namespaces, which the client sees as /dev/nvme1n1.

  • NVMe/TCP (port 4420): the Read command (SLBA, NLB; NLB counts from zero, so 16 blocks is NLB 15) goes in a CapsuleCmd PDU, the data comes back in C2HData, and the completion entry in CapsuleResp. (Demo 3)
  • NVMe/RDMA (RoCE v2 or InfiniBand): the command capsule goes in an RDMA SEND; the target's NIC writes the data straight into the host's buffer with an RDMA WRITE, and a SEND brings the response capsule. No CPU copies the data. (Demo 4)

There is no SCSI layer in between, and each CPU can have its own queue pair, so the software path on both ends is much shorter than iSCSI's. That, not fewer messages, is where most of the time goes.

Three time-down columns for one 8 KB data read. NFSv4.1: COMPOUND PUTFH, READ offset 0 count 8192, then READ OK with 8192 bytes. iSCSI: SCSI Command READ(10) LBA 16384 length 16, then Data-In 8 KB with status GOOD. NVMe/TCP: CapsuleCmd Read SLBA 16384 NLB 15, then C2HData 8 KB, then CapsuleResp status 0. Each is one round trip; toy times 155, 139 and 115 microseconds.
One data read is one round trip in all three; they differ in what the request names and in how much software it passes through.

Counting round trips and time

A first read costs two round trips everywhere: NFS needs an OPEN before the READ, and a block client needs the inode block before the data. The second read of an open file costs one. The difference is who fetches the metadata: the NFS server reads the inode from its own disk, while a block client pulls it across the network and parses it itself. The times are toy numbers (the same 80 µs SSD read for all, 10 µs per wire trip over TCP, 3 µs over RDMA, and a thinner software stack for NVMe), but the order matches what people measure.

protocolfilesystem runs on1st read2nd readmessages per read
NFSv4.1server2 RT, 310 µs1 RT, 155 µs2
iSCSIclient2 RT, 278 µs1 RT, 139 µs2
NVMe/TCPclient2 RT, 230 µs1 RT, 115 µs3
NVMe/RDMAclient2 RT, 184 µs1 RT, 92 µs3

Sharing: why two clients corrupt a LUN

A block server does not know about files, so it lets two clients use one LUN. But each client's ext4 believes it is the only one: it keeps its own copy of the free-block map in memory. In Demo 5 A creates a.log and takes LBA 20480. B's copy of the map still says 20480 is free, so B takes it too and overwrites A's 4 KB. When A reads its file back, the target returns B's bytes. Later each ext4 writes its own map and inodes over the other's. Sharing a block device safely needs a cluster filesystem (GFS2, OCFS2, VMFS) that locks across clients.

Over NFS the same two writers are safe (Demo 6): both send names and bytes, and the one XFS on the server gives a.log LBA 20480 and b.log LBA 20488. That is the trade: file level shares easily and keeps metadata in one place; block level gives one client a fast raw disk to run any filesystem or database on.

See also NFS vs AFS caching for how file clients cache, the Linux block layer for what happens below ext4 on one machine, SSD reads and writes for the drive itself, and object storage for a third way to store data over a network.

What the page leaves out

  • Login and connect: iSCSI login (CHAP, negotiation of ImmediateData, MaxRecvDataSegmentLength), NVMe-oF discovery on port 8009 and Connect commands, NFS mount and the SEQUENCE / session in every NFSv4.1 COMPOUND.
  • Client caches and readahead (the app uses O_DIRECT), multipathing, iSCSI R2T for large writes, and NVMe/TCP data digests.
  • SCSI and NVMe reservations, which let clients fence each other on a shared device but do not make a normal filesystem safe to share.
  • Real latencies depend on NICs, CPUs and load; the page's microseconds are toy values.

On the mind map

Open the Distributed Systems mind mapDistributedSystemsReplication: copies of data · what reads seeReplicationPartitioning: split data over nodesPartitioningTime and membership: order events, know who is aliveTime and membershipConsensus: agree on one value or logConsensusTransactions: one change across many servicesTransactionsMessaging: send events between systemsMessagingKafka internals: a replicated append-only logKafka internalsRedis internals: one thread, data in memoryRedis internalsKubernetes: reconcile desired stateKubernetesResilience and speed: stay up and fast under loadResilience and speedPartitioning vs shardingPartitioning vs shardingone server vs many; shard key mattersConsistent hashingConsistent hashingring: adding a node moves few keysChord DHTChord DHTfingers halve the distance: O(log N) hopsBitTorrent and the DHTBitTorrent and the DHTEvery downloader also uploadsRange vs hash partitioningRange vs hash partitioningrange: fast scans; hash: no hot spotRebalancing partitionsRebalancing partitionsmod N vs fixed vs dynamic: keys movedRedis ClusterRedis Cluster16384 hash slots, MOVED and ASKMapReduceMapReducemap, shuffle by key, reducePregel superstepsPregel superstepscompute, message, barrier, vote to haltSpark RDD lineageSpark RDD lineageLazy recipe; shuffle cuts stagesMapReduce joinsMapReduce joinssort-merge, skew, broadcast and merge joinsS3 object storageS3 object storagedata plus parity shards rebuild a fileRendezvous hashingRendezvous hashinghighest hash score of key+node winsHDFS / GFS file layoutHDFS / GFS file layoutNamenode maps blocks; datanodes pipelineNFS vs AFS cachingNFS vs AFS cachingNFS polls GETATTR; AFS gets callbacksNFS vs iSCSI vs NVMe-oFFile level: server runs the filesystemOpen the Distributed Systems mind mapDistributed Systemssplit data over nodesPartitioningPartitioning vs shardingPartitioning vs shardingone server vs many; shard key mattersConsistent hashingConsistent hashingring: adding a node moves few keysChord DHTChord DHTfingers halve the distance: O(log N) hopsBitTorrent and the DHTBitTorrent and the DHTEvery downloader also uploadsRange vs hash partitioningRange vs hash partitioningrange: fast scans; hash: no hot spotRebalancing partitionsRebalancing partitionsmod N vs fixed vs dynamic: keys movedRedis ClusterRedis Cluster16384 hash slots, MOVED and ASKMapReduceMapReducemap, shuffle by key, reducePregel superstepsPregel superstepscompute, message, barrier, vote to haltSpark RDD lineageSpark RDD lineageLazy recipe; shuffle cuts stagesMapReduce joinsMapReduce joinssort-merge, skew, broadcast and merge joinsS3 object storageS3 object storagedata plus parity shards rebuild a fileRendezvous hashingRendezvous hashinghighest hash score of key+node winsHDFS / GFS file layoutHDFS / GFS file layoutNamenode maps blocks; datanodes pipelineNFS vs AFS cachingNFS vs AFS cachingNFS polls GETATTR; AFS gets callbacksNFS vs iSCSI vs NVMe-oFFile level: server runs the filesystem
This page on the Distributed Systems mind map · 104 pages in 10 branches · open it to see the whole map and test yourself in recall mode.