Wandering Thoughts archives


Modern disk sizes and powers of two

Recently I grumbled in an aside about how disk drive vendors use decimal ('SI') numbers instead of IEC 'binary' numbers, which I and various other people consider more natural. You might wonder what makes binary sizes more natural for disk drives, especially since vendors have been using decimal sizes for a long time. My answer is that it comes down to sector size.

Almost all disks have had 512 byte sectors for decades, and disks have a user usable capacity that is an integer number of sectors. Most systems have then used sectors (or some power of two multiple of them) as the minimum filesystem allocation unit, and correspondingly the unit of used and free space. This makes it power of two units up and down the stack (although there's no reason for disks to have a power of two number of sectors).

Neither of these is inevitable. There used to be disks with different sector sizes, or at least that could be formatted to them (one source says that IBM AS/400s used 520 or 522 byte sectors, although even then they stored 512 bytes of payload data; also). Filesystems could allocate disk space in units other than sector size, but doing it in sectors makes life easier and for a long time writing to a sector was assumed to be atomic and to not touch any other sectors.

(This is definitely not the case today for any sort of drive. SSDs famously have natural write sizes very different from 512 byte sectors, and even conventional HDDs may do things like rewrite entire tracks at once.)

Similar but stronger considerations apply for disk drive bandwidth numbers. Systems read and write from almost all modern disk drives in some multiple of 512 byte 'sectors' (which these days are logical sectors instead of physical ones). This leads naturally to talking about bandwidth per second in binary units, especially since other sorts of bandwidth are often also expressed in binary units.

(The underlying network speeds are in decimal bits per second but we usually talk about network bandwidth in bytes per second using binary units. Well, network engineers may be different than system administrators like me.)

PS: The Wikipedia page on Disk sectors says that the domination of 512 byte sectors were driven by the popularity of the IBM PC.

tech/DiskSizesAndPowersOfTwo written at 22:15:10; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.