Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Unfortunately the mdadm and mdadm.conf man pages are not quite up to par. I would like to enable the --write-mostly flag for my RAID, but neither the man pages nor the internet will tell me how. I am not aware of any place to put default arguments for mdadm, nor aware of when it would be launched and by what.

It seems the logical place to add this information is mdadm.conf, but the flag is unmentioned in man mdadm.conf. Where and how can I enable --write-mostly? Thank you.

share|improve this question

2 Answers 2

up vote 9 down vote accepted

You can set a device to be write mostly with, for example,

echo writemostly > /sys/block/md0/md/dev-sda1/state

and clear the write-mostly status with

echo -writemostly > /sys/block/md0/md/dev-sda1/state

Note that you probably need to be root for this to succeed, and that

sudo echo state > /sys/block/md0/md/dev-sda1/state

won't work.

If you have other questions about mdadm or Linux Software RAID, please post them to

(you do not need to be subscribed).

The kernel panic bug that you mentioned in your answer is fixed in Linux kernel versions released in Jan 2012 and later – 3.1.10, 3.2.2, and 3.3-rc1. It only affected arrays in which all devices are 'write-mostly'.

share|improve this answer
On my system, it looks like the path would instead be/sys/block/md0/md/dev-sda1/state (note the additional /md between md0 and dev-sda1), but I'm also using an older version. – rob Jun 21 '12 at 20:48
I just tried this with both mdadm v2.6.3 and v3.2.3, and typing the command as @NeilBrown originally wrote it produces a "No such file or directory" error. Typing the command as I wrote it in my previous comment works as long as you are logged in as root. I've edited the answer to reflect the correct path. – rob Jun 22 '12 at 21:27
Hmm, it seems the writemostly property is not persistent when set using this method. After a reboot, the property disappeared. – rob Jun 22 '12 at 21:34
I find it strange how the sysfs input parameter is "writemostly", sysfs state file output is "write_mostly", and mdadm command line parameter is "write-mostly". Why so little consistency here I wonder. – lkraav Nov 30 '14 at 19:23

It's been over a week, so to answer my own question:

Apparently you pass it as a command-line argument to mdadm when you create a new RAID array; just take the example in the man page and add --write-mostly. The man page says all devices after it will have write-mostly enabled; this is vague language so I can only assume it means the reasonable thing: that it applies to the next argument.

On kernel 3.1 (released Oct 2011), however, trying --write-mostly / --write-behind triggered a panic in [something...]scsi.c during some critical step, and destroyed my RAID array.

Also if you are splitting your array, make sure you know what you're doing. I found that my array had new UUIDs (possibly due to a new major metadata version) and was unsure how to proceed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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