md write-intent bitmap
Few know about a feature that has been introduced to md since a few years now: The write-intent bitmap. This might be mainly because it’s not enabled by default (more about why later) and isn’t really visible in day-to-day operations.
So what is it exactly? Taken fromÂ md(4):
If configured, the bitmap is used to record which blocks of the array may be out of sync. Before any write request is honoured, md will make sure that the corresponding bit in the log is set. After a period of time with no writes to an area of the array, the corresponding bit will be cleared.
So, it’s a bit like the journals that we’re seeing in filesystems since recent years. But what does it gain you?
At first; nothing. Even worse, under certain I/O loads, it can hurt the performance of your array. The real benefit shows in the following two situations:
- Unclean Shutdown
- Drive Failure
In both cases, the array goes out of sync. The bitmap however allows the md subsystem to only resync areas of the array that are known, or suspected, to be out of sync. This decreases resync times dramatically: whereas one of my md arrays took 2 days, it’s now done even before the filesystems on it get mounted.
But as noted earlier, depending on your setup there might be some issues to address, namely write performance. There are tunables for the bitmap; I’ll write another article about them as soon as I’ve got some testing done.