SYSTEM Cited by 1 source
Linux Device Mapper (DM)¶
The Linux Device Mapper is the kernel block-layer proxy
mechanism that lets targets interpose on struct bio — the main
unit of I/O for the Linux block layer — and either dispatch it,
drop it, or mutate it and ask the kernel to resubmit. It's the
backend for userland LVM2 and the
substrate on which a long list of targets are built:
dm-linear— carve one big device into smaller ones.dm-stripe— combine smaller devices into one striped device.dm-raid1— software RAID mirroring.dm-snap— snapshots of arbitrary devices.dm-verity— cryptographic verification of boot devices.dm-clone— block-level async clone.dm-crypt— full-disk encryption.
Why it looks like a network protocol¶
The 2024-07-30 Fly.io
Making Machines
Move post frames the block layer as "organized as if your
computer was a network running a protocol that basically looks
just like that" — a struct bio carries an opcode (read, write,
flush, discard, secure erase, write-same, write-zeroes), a
device, and a page/len/offset vector. DM targets plug into this
bio stream the way a proxy plugs into a network protocol. "No
nerd has ever looked at a fixed-format message like this without
thinking about writing a proxy for it, and struct bio is no
exception. The proxy system in the Linux kernel for struct bio
is called device mapper, or DM."
Composition¶
DM targets can stack on top of each other. Fly's fleet stacks DM like this on the target worker during a migration:
- Source Volume mounted over the network via iSCSI appears as a block device.
dm-cryptwraps it to produce the plaintext view.dm-clonetakes that plaintext source device + a fresh local target device + a metadata device, and presents the cloned plaintext volume.- The new Fly Machine mounts the cloned plaintext volume.
Seen in¶
- sources/2024-07-30-flyio-making-machines-move — Load-bearing description of DM as the kernel's block-layer proxy system; anchors every DM target the post relies on.
Related¶
- systems/dm-clone — The canonical DM target for Fly.io's migration path.
- systems/dm-crypt-luks2 — How Fly encrypts Volumes in DM.