1
Linux & Advanced Storage Interfaces
Introduction
The industry migration towards harddrives with 4KiB physical blocks has caused us to make
some changes to the Linux block I/O stack. These changes leverage existing parameters in
SCSI Block Commands and the ATA Command Set to provide reporting of alignment and
preferred I/O request sizes. The values provided are used by partition tools, LVM and MD
as well as filesystems to ensure that data is layed out in an optimal fashion.
Furthermore, advanced technologies such as SSD, DIF & DIX, and thin provisioning have
required changes to the way Linux queries and drives storage devices.
This document provides a set of recommendations for storage device vendors about which
values to report to make Linux perform optimally.
1 Block Sizes & I/O Topology (Linux 2.6.31)
1.1 Logical vs. Physical Block Size
Until recently what has been commonly referred to as sector size has been both the unit
used by the programming interface to address a location on disk as well as the size used
internally by the drive firmware to organize user data. In this document (and in the Linux
kernel) we distinguish between:
• physical block size is the size used internally by the device firmware
• logical block size is the unit used to address a location on the storage
1.2 ATA Command Set
Linux will generally assume that an ATA device has both a logical and physical block size
of 512 bytes. If that is not the case the following values must be reported by the device.
1.2.1 512-byte Logical Block Size, 4096-byte Physical Block Size
Word 106 bit 15 must be 0 and bit 14 must be 1. This signals that word 106 is valid. Bit 13
must be set to indicate that bits 3:0 are valid and that word 209 is specified.
Bits 3:0 indicate the physical block size exponent. I.e. 2
n
logical blocks/physical block. For
a drive with 4096-byte physical blocks and 512-byte logical blocks, a value of 3 is reported
in bits 3:0 (2
3
= 8).