mdadm raid1 is in auto-read-only mode at boot

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Software Raid using mdadm.

Issue

  • raid1 is in auto-read-only mode at boot.
md0 : active (auto-read-only) raid1 vdc[0]  <<<
      1046528 blocks super 1.2 [2/1] [U_]

Resolution

  • We can bring the raid1 array from inactive read-only mode to active read-write mode as soon as we have a minimal number of devices:
[root@testbox ~]# cat /proc/mdstat 
Personalities : [raid1] 
md0 : inactive vdc[0](S)     <<<
      1046528 blocks super 1.2

[root@testbox ~]# mdadm -R /dev/md0 
mdadm: started array /dev/md/0
[root@testbox ~]# cat /proc/mdstat 
Personalities : [raid1] 
md0 : active (auto-read-only) raid1 vdc[0]  <<<
      1046528 blocks super 1.2 [2/1] [U_]

[root@testbox ~]# mdadm --readwrite /dev/md0 
[root@testbox ~]# cat /proc/mdstat 
Personalities : [raid1] 
md0 : active raid1 vdc[0]   <<<<
      1046528 blocks super 1.2 [2/1] [U_]

As per mag page of #mdadm:

--run (-R):  Run any array assembled as soon as a minimal number of devices are available, rather than waiting until all expected devices are present.

--readwrite (-w):   mark array as readwrite.

Root Cause

  • The auto-read-only is because the array is not being used and there is no file system on top of it. The first write to the array (/dev/mdX) should bring the raid1 automatically to read write mode.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments