Archives

Categories

Write Intent Bitmaps

When previously writing about how I partition disks [1] I mentioned that I use smaller RAID partitions than the maximum size to reduce reconstruction time in the event of a crash.

Linux software RAID has a feature known as write intent bitmaps which means that every time some data is about to be written the region of the RAID array is marked as dirty. Then after a power failure all that needs to be done to ensure that all disks in the array have matching data is to check the regions that are listed as dirty not the entire disk. So instead of spending an hour or more checking the data there would only be a few seconds of work required.

To enable this feature you use the mdadm option -binternal (for an internal bitmap – most people would never want an external bitmap). This can be done at array creation time or at any other time via the grow option. For example if you want to enable this feature on /dev/md0 then you would use the command mdadm -G /dev/md0 -binternal.

Here is an example of /proc/mdstat when it’s not enabled:
Personalities : [raid1]
md1 : active raid1 hda2[0] hdb2[1]
38981632 blocks [2/2] [UU]

md0 : active raid1 hda1[0] hdb1[1]
96256 blocks [2/2] [UU]

Here is the same system with the feature enabled:
Personalities : [raid1]
md1 : active raid1 hda2[0] hdb2[1]
38981632 blocks [2/2] [UU]
bitmap: 3/149 pages [12KB], 128KB chunk

md0 : active raid1 hda1[0] hdb1[1]
96256 blocks [2/2] [UU]
bitmap: 0/12 pages [0KB], 4KB chunk

The down-side to this feature is that it will slightly reduce performance. But when comparing the possibility of a few percent performance loss all the time and the possibility of a massive performance loss for an hour or two after a crash it seems that losing a few percent all the time is almost always the desired option.

2 comments to Write Intent Bitmaps