The Interface
This lesson discusses the interface of a typical hard-disk.
Let’s start by understanding the interface to a modern disk drive. The basic interface for all modern drives is straightforward. The drive consists of a large number of sectors (512-byte blocks), each of which can be read or written. The sectors are numbered from to on a disk with sectors. Thus, we can view the disk as an array of sectors; to is thus the address space of the drive.
Multi-sector operations are possible; indeed, many file systems will read or write 4KB at a time (or more). However, when updating the disk, the only guarantee drive manufacturers make is that a single 512-byte write is atomic (i.e., it will either complete in its entirety or won’t complete at all). Thus, if an untimely power loss occurs, only a portion of a larger write may complete (sometimes called a torn write).
There are some assumptions most clients of disk drives make, but those are not specified directly in the interface.
Get hands-on with 1400+ tech skills courses.