Chapter 18. Storage I/O Alignment and Size
Recent enhancements to the SCSI and ATA standards allow storage devices to incidate their preferred (and in some cases, required) I/O alignment and I/O size. This information is particularly useful with newer disk drives that increase the physical sector size from 512 bytes to 4k bytes. This information may also be beneficial for RAID devices, where the chunk size and stripe size may impact performance.
The Linux I/O stack has been enhanced to process vendor-provided I/O alignment and I/O size information, allowing storage management tools (
mkfs., and the like) to optimize data placement and access. If a legacy device does not export I/O alignment and size data, then storage management tools in Red Hat Enterprise Linux 6 will conservatively align I/O on a 4k (or larger power of 2) boundary. This will ensure that 4k-sector devices operate correctly even if they do not indicate any required/preferred I/O alignment and size.
18.1. Parameters for Storage Access
The operating system uses the following information to determine I/O alignment and size:
Smallest internal unit on which the device can operate
Used externally to address a location on the device
Tthe number of bytes that the beginning of the Linux block device (partition/MD/LVM device) is offset from the underlying physical alignment
The device’s preferred minimum unit for random I/O
The device’s preferred unit for streaming I/O
For example, certain 4K sector devices may use a 4K
physical_block_size internally but expose a more granular 512-byte
logical_block_size to Linux. This discrepancy introduces potential for misaligned I/O. To address this, the Red Hat Enterprise Linux 6 I/O stack will attempt to start all data areas on a naturally-aligned boundary (
physical_block_size) by making sure it accounts for any alignment_offset if the beginning of the block device is offset from the underlying physical alignment.
Storage vendors can also supply I/O hints about the preferred minimum unit for random I/O (
minimum_io_size) and streaming I/O (
optimal_io_size) of a device. For example,
optimal_io_size may correspond to a RAID device's chunk size and stripe size respectively.