In this lesson, you will learn how the Linux kernel passes data requests through a vertical stack of virtual and physical layers to reach your storage hardware.
The Anatomy of an I/O Request
Think of the block device stack as a "pipeline." When an application writes a file, the request doesn't jump straight to the physical disk. Instead, it travels through several logical layers.
- The Application/Filesystem Layer: You issue a write command to an
ext4orxfsfilesystem. - The Logical Volume Layer (Device Mapper): Before reaching the disk, the request may hit the
dm(Device Mapper) layer. This is where technologies like LVM (Logical Volume Manager) or LUKS (Encryption) reside. The device mapper intercepts the block address, translates it to a new location, and passes it down. - The Request Queue & Scheduler: The request enters a queue managed by an I/O scheduler (the "elevator" algorithm). Here, the kernel decides the order of operations to maximize efficiency.
- The Physical Driver Layer: Finally, the driver talks to the hardware (like NVMe or SATA) to perform the physical voltage change on the media.
Visualizing the Path
You can see how these layers stack on your own system using the lsblk command. It displays the hierarchy of your devices:
lsblk -o NAME,TYPE,MOUNTPOINT
NAME TYPE MOUNTPOINT
sda disk
├─sda1 part /boot
└─sda2 crypt /home <-- LUKS (Device Mapper)
└─vg-lv lvm / <-- LVM (Device Mapper)
In this output, vg-lv is a logical volume managed by LVM, which sits on top of an encrypted layer (crypt), which ultimately sits on a physical partition (sda2). When you save a file to /, your request is "wrapped" at each of these layers. The LVM layer calculates which physical extent to use, the encryption layer adds a security transform, and the underlying physical disk driver executes the write.
This layering is what makes Linux storage so flexible. Because each layer only talks to the one below it, you can swap out an encryption layer or resize a partition without ever telling the filesystem that the physical hardware has changed.
Key Takeaway: Block device layering uses a modular "stack" where each layer—from filesystems to volume managers—performs a specific transformation on I/O requests before they finally reach the hardware driver.