How to clear up pending resync on RAID array

I have already wrote a couple of posts about software RAID setup and recovery. Today I will briefly describe how to switch array to read-write state and begin resync process.

This problem can be identified by inspecting kernel ring buffer and array states. Notice that background reconstruction started on the md1 array, but it is in auto-read-only state and resynchronization is pending.

# dmesg
[...]
[    1.312811] md: md0 stopped.
[    1.313511] md: bind<sdb1>
[    1.313601] md: bind<sda1>
[    1.314335] md: raid1 personality registered for level 1
[    1.314572] md/raid1:md0: active with 2 out of 2 mirrors
[...]
[    1.516790] md: md1 stopped.
[    1.517457] md: bind<sdb2>
[    1.517545] md: bind<sda2>
[    1.518947] md/raid1:md1: not clean -- starting background reconstruction
[    1.518949] md/raid1:md1: active with 2 out of 2 mirrors
[...]
# cat /proc/mdstat
Personalities : [raid1] 
md1 : active (auto-read-only) raid1 sda2[0] sdb2[1]
      4203104 blocks super 1.2 [2/2] [UU]
        resync=PENDING
      
md0 : active raid1 sda1[0] sdb1[1]
      973524352 blocks super 1.2 [2/2] [UU]
      
unused devices: <none>

Execute following command to switch array to read-write state and begin resync process.

# mdadm --readwrite /dev/md1 

Transition will be immediately visible by inspecting array states.

# cat /proc/mdstat
Personalities : [raid1] 
md1 : active raid1 sda2[0] sdb2[1]
      4203104 blocks super 1.2 [2/2] [UU]
      [=>...................]  resync =  8.1% (333952/4203104) finish=1.3min speed=47707K/sec
      
md0 : active raid1 sda1[0] sdb1[1]
      973524352 blocks super 1.2 [2/2] [UU]
      
unused devices: <none>

The end result can be verified after synchronization process finishes.

# cat /proc/mdstat
Personalities : [raid1] 
md1 : active raid1 sda2[0] sdb2[1]
      4203104 blocks super 1.2 [2/2] [UU]
      
md0 : active raid1 sda1[0] sdb1[1]
      973524352 blocks super 1.2 [2/2] [UU]
      
unused devices: <none>

Transition messages will be stored in kernel ring buffer.

# dmesg
[171485.722209] md: md1 switched to read-write mode.
[171485.722895] md: resync of RAID array md1
[171485.722898] md: minimum _guaranteed_  speed: 1000 KB/sec/disk.
[171485.722901] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for resync.
[171485.722905] md: using 128k window, over a total of 4203104k.
[171558.652298] md: md1: resync done.
[171558.764453] RAID1 conf printout:
[171558.764457]  --- wd:2 rd:2
[171558.764460]  disk 0, wo:0, o:1, dev:sda2
[171558.764463]  disk 1, wo:0, o:1, dev:sdb2
Milosz Galazka's Picture

About Milosz Galazka

Milosz is a system administrator working for a successful Polish company and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu