dm-zero
dm-zero is a Linux device-mapper target that supplies zero-filled ordinary reads and silently discards writes.
The zero target has no target-specific parameters and retains no written payload. A large mapped address range therefore does not reserve storage. It behaves like a block-device counterpart of /dev/zero, not a writable sparse file. [1]
Linux v6.12 zero_map completes ordinary reads with zeros and silently completes writes and discards. A read bio marked REQ_RAHEAD is instead rejected; other operation types reaching this callback are also rejected. These are target-level behaviors, not guarantees about an application's buffered reads. [2]
The documented sparse-device construction puts a snapshot over the zero origin and stores changed chunks on a separate copy-on-write device. That additional layer retains writes; its finite backing space must be monitored. The zero target alone cannot provide this retention. [1] [3]
Relations
- related
- Device-mapper, dm-error, Storage snapshot
Advantages
- Provides a zero-valued origin without allocating a matching payload backing device.
Limitations
- Neither zero-filled reads nor successful discarded writes demonstrate that previously stored data was erased.
Citations
- Linux v6.12: zero target and snapshot-backed sparse devices
- Linux v6.12: dm-zero ordinary reads, readahead, writes and discard
- Linux v6.12: snapshot COW storage, chunks and exhaustion
Sources & caveats
- Source review of Linux v6.12, pinned to commit adc218676eef25575469234709c2d87185ca223a; no device creation, fault injection or performance experiment.