Friday, 27 March 2020

Assembling a mdadm RAID volume with an external write-intent bitmap at boot on Fedora, CentOS and RHEL

When a drive drops out of an array, and then reintroduced, mdadm has to resync the array. This is long process, but can be sped up greatly by using a write-intent bitmap.

There are 2 types of bitmaps that can be created for an mdadm array - internal and external.

Internal bitmaps are written onto the disks in the array itself. It is the simplest and most straight-forward method and requires little setup and maintenance beyond initial creation. The drawback is that it affects write performance as the bitmap has to be continuously updated during writes.

Compared to internal bitmaps, external bitmaps have much less write performance penalty for mdadm RAID arrays. However, external bitmaps are difficult to set-up as they are files, which means that the RAID array has to be assembled after the partition containing the bitmap file has already been mounted. The reverse is normally the case - mdadm devices are usually assembled before partitions from /fstab are mounted.

After a lot of work reading documentation and testing out the behaviour of the system, here is a method that works (non-root RAID arrays only) on Fedora and derived distros such as RHEL and CentOS -

First add the bitmap to the array -

mdadm /dev/md15 --grow --bitmap=/boot/raid15.bitmap

If you place the bitmap outside of your rootfs (such as in /boot or another partition), add the line for that partition into the /etc/fstab.sys file for dracut to execute before RAID assembly. This step can be skipped if your external bitmap is on the rootfs.

echo "LABEL=boot /boot ext4 defaults 1 2" > /etc/fstab.sys

Scan the arrays for the mdadm.conf command to put into the conf file -

mdadm --detail --scan

Then, update the /etc/mdadm.conf file to assemble the array with the external bitmap -

ARRAY /dev/md15 UUID=<uuid> bitmap=/boot/raid15.bitmap

After this, we are ready to run dracut to regenerate the initramfs -

dracut -f

Finally, if SELinux is installed, mdadm won't be able to open the bitmap file properly. Use chcon to change the label on the file so that mdadm can open it -

chcon system_u:object_r:mdadm_var_run_t:s0 /boot/raid15.bitmap

That should be it. The md device should come back up on system boot. Check with -

cat /proc/mdstat

And make sure the array is assembled and that the bitmap is loaded.



Missing GPUGraphicsClockOffset and GPUMemoryTransferRateOffset in nvidia-settings for overclocking from the terminal (Linux)

For those that are using Linux and encountering the following error messages when trying to adjust the overclock offset in the terminal - ER...