Add linux md raid write journal to and existing array
It kind of should work like this:
# mdadm --manage /dev/md42 --readonly --add-journal /dev/loop3
mdadm: Journal added successfully, making /dev/md42 read-write
mdadm: added /dev/loop3
However, currently (using kernel 4.18, mdadm 4.1-rc) that only seems to be possible for arrays that were created with journal in the first place. The above output was procuded after:
# mdadm --create /dev/md42 --level=5 --raid-devices=3 /dev/loop[012] --write-journal /dev/loop3
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md42 started.
# mdadm --manage /dev/md42 --fail /dev/loop3 --remove /dev/loop3
mdadm: set /dev/loop3 faulty in /dev/md42
mdadm: hot removed /dev/loop3 from /dev/md42
Creating an array without journal, all attempts to add a journal fail:
# mdadm --create /dev/md42 --level=5 --raid-devices=3 /dev/loop[012]
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md42 started.
# mdadm --manage /dev/md42 --readonly --add-journal /dev/loop3
mdadm: /dev/md42 does not support journal device.
# mdadm --manage /dev/md42 --readwrite --add /dev/loop3
# echo journal > /sys/block/md42/md/dev-loop3/state
bash: echo: write error: Invalid argument
So it just doesn't seem to be possible yet.
I have found a discussion on the linux-raid mailing list that this is a planned feature. If it has been implemented since, I don't see how. Perhaps contact the mailing list yourself to remind mdadm devs there are people who want this to work!
You might have to resort to mdadm --create
to re-create the raid or edit metadata of the array. Either option is a bit dangerous.