The simple version
Think of a huge library. Nobody hands the librarian single letters; they hand over whole pages. Pages are stored on shelves of a fixed size, and if you want to change one word, the librarian takes the whole page down, fixes it and puts it back.
A disk works the same way. Letters are bytes. The page is a sector or block. The disk never reads or writes less than one block, even if you only wanted one byte.
Bits, bytes and the two kinds of kilo
A bit is 0 or 1; a byte is 8 bits. Storage vendors count in powers of ten (1 TB = 1012 bytes) while operating systems often count in powers of two (1 TiB = 240 bytes). That gap is why a "7.68 TB" drive shows up as about 6.98 TiB.
Sectors, logical and physical block size
The device exposes a logical block size (the smallest unit you can address) and has a physical block size (the unit it really writes internally). Common combinations:
| Format | Logical | Physical | Notes |
|---|---|---|---|
| 512n | 512 B | 512 B | Older drives |
| 512e | 512 B | 4096 B | Emulates 512 B; a misaligned 512 B write forces a read-modify-write of 4 KiB |
| 4Kn | 4096 B | 4096 B | Native 4K; common on NVMe namespaces formatted for 4K |
Filesystem blocks vs device blocks
On top of the device, the filesystem has its own block size (usually 4 KiB for ext4 and XFS). The page cache also works in 4 KiB pages on x86-64. When all three line up at 4 KiB, one application write of 4 KiB can map cleanly to one device write.
AI datasets rarely care about one 4 KiB block. They care about many blocks, which is where IOPS and throughput (Lesson 2) take over.
Tools
lsblk -o NAME,SIZE,PHY-SEC,LOG-SECShow each device's physical and logical sector size.
blockdev --getss /dev/nvme0n1Logical sector size in bytes.
blockdev --getpbsz /dev/nvme0n1Physical block size in bytes.
nvme id-ns -H /dev/nvme0n1List the LBA formats a namespace supports and which one is in use.
Quiz
Lab
Lab 1.1 · fio shows low IOPS
A colleague benchmarked a new drive with fio --name=t --filename=/dev/nvme1n1 --rw=randread --bs=4k --runtime=60 --time_based --readonly and got about 12k IOPS. The datasheet promises far more. They think the drive is faulty.
Try it now in the simulator (opens with the command ready; press Enter):
$ lsblk -o NAME,SIZE,PHY-SEC,LOG-SEC$ blockdev --getss /dev/nvme0n1$ blockdev --getsize64 /dev/nvme0n1