Linux RAID6 setup with externel write-intent bitmap and initial sync tuning

By steve, 22 February, 2016

I have been re-configuring my home system to try and optimise the performance of the RAID volumes. I have just finished setting up a 6 disk RAID6 with a 64k stripe size (based on these benchmarks http://louwrentius.com/linux-raid-level-and-chunk-size-the-benchmarks.h…) and an external write-intent bitmap on an ext2 filesystem (to avoid any journal overheads).

Before I begin, the following will not work for the boot partition because the scripts do not run until after the initrd has mounted the root partition.

First, I created a new ext2 filesystem that was not on any RAID or LVM array so it could be mounted before the mdadm or LVM start scripts has run (because my RAID6 is a PV for LVM, which I want to combine with dm-cache for performance).

I mounted the ext2 on /mdadm-bitmap, which gave me issues until I added the following at the end of /etc/default/mdadm:

# Make sure the bitmap mount point is mounted
mountpoint -q /mdadm-bitmap || (fsck -p /mdadm-bitmap ; mount /mdadm-bitmap)

I also had to add the bitmap option to the mdadm config file as follows:

ARRAY /dev/md5 UUID=xxxxxxxx:xxxxxxxx:xxxxxxxx:xxxxxxxx bitmap=/mdadm-bitmap/md5.bitmap

At this point, the system booted and used the bitmap, but the resync speed was very slow. To fix this, I ran the following command and added it to /etc/rc.local

# Increase RAID6 speed
echo 32768 > /sys/block/md5/md/stripe_cache_size

This does increase the RAM requirements for the RAID subsystem, and as far as I can guess from the option name, it increases the amount of data that the MD driver will use for in-flight stripes, which allows for more efficient IO.

There are some other tips at http://www.cyberciti.biz/tips/linux-raid-increase-resync-rebuild-speed… for increasing the RAID rebuild speed, but I found that this option made my resync 10x faster.

Comments