1984 – the techblog

(Hopefully) useful various sysadmin and other stuff.

md write-intent bitmap

Few know about a fea­ture that has been intro­duced 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 vis­i­ble in day-to-day operations.

So what is it exactly? Taken from md(4):

If con­fig­ured, the bitmap is used to record which blocks of the array may be out of sync. Before any write request is hon­oured, md will make sure that the cor­re­spond­ing bit in the log is set. After a period of time with no writes to an area of the array, the cor­re­spond­ing bit will be cleared.

So, it’s a bit like the jour­nals that we’re see­ing in filesys­tems since recent years. But what does it gain you?

At first; noth­ing. Even worse, under cer­tain I/O loads, it can hurt the per­for­mance of your array. The real ben­e­fit shows in the fol­low­ing two situations:

  1. Unclean Shut­down
  2. Drive Fail­ure

In both cases, the array goes out of sync. The bitmap how­ever allows the md sub­sys­tem to only resync areas of the array that are known, or sus­pected, to be out of sync. This decreases resync times dra­mat­i­cally: whereas one of my md arrays took 2 days, it’s now done even before the filesys­tems on it get mounted.

But as noted ear­lier, depend­ing on your setup there might be some issues to address, namely write per­for­mance. There are tun­ables for the bitmap; I’ll write another arti­cle about them as soon as I’ve got some test­ing done.

Leave a Reply