Understanding Disk Structure: Physical Components, Logical Layout, and Using fdisk on Linux
This article explains the physical makeup of mechanical hard drives—including platters, heads, tracks, cylinders and sectors—shows how to view disk details with Linux commands like lsblk and fdisk, and clarifies common misconceptions about heads, cylinders and sector sizes.
After a long break since the last memory‑related post, the author uses the opportunity to discuss the structure of magnetic disks, reflecting briefly on recent world events before diving into technical details.
1. Disk Structure
For mechanical hard drives the basic physical hierarchy consists of disk surfaces (platters) , each read by a head, tracks (concentric circles on a surface), cylinders (the set of tracks at the same radius across all surfaces) and sectors (the smallest addressable block on a track). The article includes an illustration of a disassembled HDD and a logical diagram of the layout.
The smallest storage unit is the sector. Capacity formulas are given:
Capacity per cylinder = (bytes per sector) × (sectors per cylinder) × (number of surfaces)
Total disk capacity = (capacity per cylinder) × (total number of cylinders)
Sectors are not stored back‑to‑back; each sector ends with an error‑correction code that allows the drive to detect and retry a read if a fault occurs.
2. Hands‑on Inspection
Linux provides transparent access to disk geometry. The lsblk command lists block devices, while fdisk reveals detailed geometry.
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 20T 0 disk
`-sdb1 8:17 0 20T 0 part /search
sda 8:0 0 278.5G 0 disk
|-sda1 8:1 0 200M 0 part /boot
`-sda2 8:2 0 278.3G 0 part
|-vgroot-lvroot (dm-0) 253:0 0 10G 0 lvm /
|-vgroot-lvswap (dm-1) 253:1 0 8G 0 lvm [SWAP]
|-vgroot-lvvar (dm-2) 253:2 0 15G 0 lvm /var
|-vgroot-lvusr (dm-3) 253:3 0 10G 0 lvm /usr
`-vgroot-lvopt (dm-4) 253:4 0 136.7G 0 lvm /optFrom the output the author’s server has two disks: sda (278.5 GB) and sdb (20 TB). Using fdisk -l /dev/sda yields:
#fdisk -l /dev/sda
Disk /dev/sda: 299.0 GB, 298999349248 bytes
255 heads, 63 sectors/track, 36351 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
Disk identifier: 0x00053169
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 36352 291785728 8e Linux LVMKey observations:
255 heads → 255 logical surfaces.
36351 cylinders → each surface has that many tracks.
63 sectors per track.
Logical sector size is 512 bytes; physical sector size is 4096 bytes.
Total size = 36351 cylinders × 8225280 bytes = ~299 GB.
3. Questions About fdisk Output
Q1: Are all “units” (cylinders) the same size? Historically, early disks stored the same amount of data per track, giving higher density on inner tracks. Modern disks use zone‑bit recording (variable sectors per track) and present a linear LBA address space, so the reported cylinder size is a logical abstraction.
Q2: What is the physical sector size? Modern drives use 4 KB physical sectors, but they expose 512‑byte logical sectors for compatibility. The kernel maps each 4 KB physical sector to eight 512‑byte logical sectors.
Physical and logical sector sizes can also be read directly:
# cat /sys/block/sda/queue/physical_block_size
# cat /sys/block/sda/queue/logical_block_sizeQ3: Does the drive really have 255 heads? The image of a real HDD head shows only a few heads; the 255 heads reported by fdisk are virtual values used for CHS compatibility, not actual hardware heads. Cylinders are similarly virtual.
Refining Core Development Skills
Fei has over 10 years of development experience at Tencent and Sogou. Through this account, he shares his deep insights on performance.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.