Anatomy of a Disk Drive

Last Updated on 05/06/2014 by dboth

It is not really necessary to understand the physical or logical structure of a disk drive or how it works  in order to use Linux or any other operating system. Such knowledge can be quite helpful, however, when you are attempting to perform problem determination on a system which is responding sluggishly. One of the first places to look when you are troubleshooting a performance issue is at disk performance.

Only by understanding the function and structure of disk drives can you hope to improve performance.

Inside a Disk Drive

Figure 1: Inside a Disk Drive

A hard drive, aka disk drive, consists of one or more metal or glass platters coated with a magnetic recording medium. Each platter has two surfaces, top and bottom, on which data can be recorded. Read/write heads write data onto the recording surface and read it back when requested by the operating system. The data is recorded on circular tracks on each platter.

In the illustration above, the drive has three platters and six read/write heads. The heads are aligned vertically so that they are each lined up over the same data track on their respective platters. There are hundreds of tracks on each surface and the six vertically aligned tracks under the read/write heads are known as a cylinder.

The  actuator moves the heads across the disk surface to align the heads with different cylinders to read and write data.

Disk Space Allocation

The cylinder is the minimum increment of space that can be allocated to a partition when installing Linux or creating partitions from free disk space. This is the reason that a requested allocation of 1000MB for a partition might actually become 1985MB. The output from fdisk below, shows that a cylinder is about 8MB in size.

[root@david 20]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): u

Changing display/entry units to cylinders (DEPRECATED!).

Command (m for help): p
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
Geometry: 255 heads, 63 sectors/track, 38913 cylinders
Units: cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000aa325

Device    Boot Start       End    Blocks  Id System
/dev/sda1          1       262   2097152  83 Linux
/dev/sda2        262     38914 310473048  8e Linux LVM

Note that it is necessary to change the units to cylinders in order to see this. The option to display disk space in cylinders is deprecated and may not work in the future.