Β§37.1–37.3The Interface … A Simple Disk Drive

Part III OSTEP pp. 433–437 Β· ~6 min read

  • sector
  • platter
  • track
  • rotational delay
  • seek time
  • track skew
  • multi-zoned disk
  • track buffer
  • write-back caching

Now the star device of persistence: the hard disk drive. File systems are shaped by how disks behave, so we build a model of one first.

The Crux: How To Store And Access Data On Disk

How do modern hard drives store data? What is the interface, how is data laid out and accessed, and how does disk scheduling improve performance?

37.1 The Interface

A disk is simply an array of sectors β€” 512-byte blocks numbered 0 to nβˆ’1 (the drive’s address space). You can read or write any sector; file systems often move 4KB (8 sectors) at a time. But the only atomicity guarantee is that a single-sector write completes fully or not at all β€” a larger write cut short by power loss can leave a partial torn write. And the β€œunwritten contract”: nearby blocks are faster to reach than distant ones, and sequential access is far faster than random.

37.2 Basic Geometry

Data lives on a platter β€” a circular surface coated in magnetic material, holding bits even when powered off. Platters bind to a spindle spun by a motor at a fixed rate (7,200–15,000 RPM). Each surface holds thousands of concentric tracks (hundreds fit in a hair’s width); a read/write head on a movable arm (one per surface) positions over the target track.

37.3 A Simple Disk Drive

Servicing a request takes three steps β€” walk through a real one:

A disk request, start to finish: seek to the track, wait for rotation, then transfer. (The head is fixed at the top; the platter spins under it.)
01234567891011β—‰head + arm↻

1A single track

A platter is a magnetic surface spun on a spindle at a fixed rate (RPM). Data sits in concentric tracks; here one track of 12 sectors (0–11), each a 512-byte block.

step 1 / 6

Two costs dominate. The rotational delay is the wait for the sector to spin under the head (avg β‰ˆ R/2). The seek time is moving the arm to the right track β€” and it’s not instant: the arm must accelerate, coast, decelerate, and carefully settle (0.5–2 ms) onto the track. Then the transfer completes the I/O.

A few more realities

Real drives add cleverness. Track skew shifts the sector numbering between adjacent tracks so that after a track switch the next sequential block is just arriving β€” not just missed (which would cost a whole rotation):

Track skew: block 12 (inner) is offset from block 0 (outer) so it arrives just after the head finishes switching tracks.

no skewblk 0blk 12← already passed! wait ~1 full rotationskew of 2blk 0blk 12arrives just as the head settles βœ“

Two more: a multi-zoned disk packs more sectors on outer tracks (there’s more room out there), grouping tracks into zones with a fixed sectors-per-track. And every drive has a track buffer β€” a small (8–16 MB) internal cache; e.g. on a read it may pull in the whole track to answer later same-track requests fast. That cache forces a write policy choice β€” write-back caching vs write-through:

The drive's track buffer must choose WHEN to acknowledge a write.
acknowledges a write…trade-off
Write-back (immediate)as soon as the data is in the drive's memoryappears faster β€” but risky
Write-throughonly after the data reaches the plattersafe, but slower
Dotted-underlined cells have explanations β€” click one.

With this model of where time goes on a disk, we can now put numbers to it.

Check yourself: disk anatomy

1.What is a sector, and what atomicity does the disk guarantee?

2.A disk request's service time is the sum of which three components?

3.What is the rotational delay, and what is it on average?

4.Why isn't a seek instantaneous?

5.What problem does track skew solve?

6.The drive's track buffer forces a write policy choice. What's the trade-off between write-back and write-through?

6 questions