Write-intent bitmap
A write-intent bitmap tracks regions of a redundant array that may need synchronization after interrupted writes.
A bit identifies a region, not the old or new user data needed to replay its update. [1]
The md driver lists the bitmap among its consistency policies after an unclean stop, next to full resync and a journal device for RAID 4/5/6. Each bit covers a chunk of configurable size, a portion of each device for RAID 4/5/6 and of the array for RAID 10. An internal bitmap sits in the array metadata area and is replicated on all devices, and a manually requested check or repair ignores it. [1]
In memory each chunk has a 16-bit counter with two flag bits and 14 bits of pending writes. The first write to a clean chunk sets the on-disk bit, and a periodic sweep steps an idle counter from 2 to 1 and then clears the bit, so a bit is cleared 2 to 3 time-base intervals after the chunk is known to be in sync. One 4,096-byte page holds 2,048 counters. [4] [1]
A RAID 5 or 6 array that is both dirty and degraded can hold undetectable corruption, so md refuses to start it unless forced. [1] For a 4 TB mirror with 64 MiB chunks, about 59,605 bits (7.5 KB) cover the device, and 10 dirty chunks mean 640 MiB to resynchronise instead of 4 TB.
Relations
- related
- RAID write hole, Partial Parity Log, RAID 5, Mirroring (storage), Parity inconsistency, Journal-guided resynchronization
Advantages
- A removed device can be re-added by updating only the blocks that changed since it was removed, instead of a full reconstruction. [5]
- A bitmap can be added to or removed from an active array, and the internal bitmap chunk defaults to 64 MiB or larger so that it fits the available space. [5]
Limitations
- A bitmap is not a data journal or an independent copy of missing contents. [1, 2]
- A bitmap alone does not close the parity write hole. Linux MD offers a data journal for RAID 4/5/6 and PPL for RAID5 without a separate journal device; their recovery guarantees differ. [2, 6]
- Bit clearing is switched off when writes happen on a degraded array or the array degrades during a write. [1]
Citations
- Linux v6.12: RAID arrays, dirty/degraded assembly and bitmap metadata
- Linux v6.12: RAID 4/5/6 cache
- Linux v6.12 drivers/md/md-bitmap.c, comments on the in-memory bitmap counters.
- mdadm manual page source (mdadm.8.in), md-raid-utilities, main branch.
- Linux v6.12: Partial Parity Log, recovery scope and distributed metadata
Further reading
Sources & caveats
- Kernel documentation and code are v6.12 project material and the mdadm manual is a moving main branch, so defaults may differ by kernel, tool version and metadata format.
- The sources describe Linux md only, not hardware RAID controllers or other software RAID.
- No cited source quantifies the effect of the bitmap on write performance.
- Arithmetic: 4 x 10^12 / 67,108,864 = about 59,605 chunks, 7.5 KB as bits or about 119 KB as 16-bit counters; 10 x 64 MiB = 640 MiB, about 0.017% of 4 TB; 16 TB needs about 238,419 bits (29.8 KB).