When you try to add a bitmap to a Linux md-raid which is currently under recovery, you’ll get an error that says mdadm: Cannot add bitmap while array is resyncing or reshaping etc. failed to set internal bitmap. Here is a solution that should be applied in the early resync process, as you will loose the current progress.
First, you’ll need to mark the drive/partition that is resynced as bad.
# mdadm --manage --fail /dev/md1 /dev/sdc2
mdadm: set /dev/sdc2 faulty in /dev/md1
Than add the bitmap to the array.
# mdadm --grow --bitmap=internal /dev/md1
Next step, remove the failed drive from the array and add it again.
# mdadm --manage --remove /dev/md1 /dev/sdc2
mdadm: hot removed /dev/sdc2 from /dev/md1
# mdadm --manage --add /dev/md1 /dev/sdc2
mdadm: added /dev/sdc2
Now the resync is running again and remembers the progress even after power loss.