1

I have a raid5 array with quite large disks, so reconstruction is really slow in case of a power outage. Thankfully, there is the --write-journal option for linux md raid. The man page lists the --write-journal option in the For create, build, or grow: section, so I supposed it should work in grow mode, and tried to add a write journal on the fly:

# mdadm --grow /dev/md1 --write-journal /dev/ssd/md1-journal
mdadm: :option --write-journal not valid in grow mode

Does anyone know whether I can add a write journal to an existing array? And if so, how?

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.