How to stop resync and start rebuild on software raid (mdadm)?

6,189

I was not able to wait for a solution, anything I found online didn't work while the array was active. So I stopped the array

mdadm --stop /dev/md0

and then started it again

mdadm --assemble /dev/md0 /dev/sd{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x}

This effectively stopped the resync and started rebuild.

Share:
6,189

Related videos on Youtube

Tomas M
Author by

Tomas M

Updated on September 18, 2022

Comments

  • Tomas M
    Tomas M almost 2 years

    I have RAID6 on 24 drives. The raid was setup with mdadm, so it is a software raid. One of the drives died and the server freezed due to that, so it had to be rebooted using Power Cycle (power off + power on).

    When the server booted, it started the RAID array with 23 devices, and it started resync operation. If I understand it correctly, this resync just reads data on all drives and checks if everything is all right, no writes are performed. I can confirm this by iostat -m 1 which shows only reading.

    So I've replaced the faulty drive by a new one, and I would like to start REBUILD, so it actually writes data to the newly added device. I have issued the following command:

    mdadm --add /dev/md0 /dev/sdc # this adds sdc to the array
    

    It went smoothly, however the raid is still resyncing, not rebuilding. The drive is reported as spare (S) in /proc/mdstat, and it probably waits for the resync to finish in order to start rebuild.

    I have to say that I don't care about resync, I need it stopped immediately and start rebuild immediately. Is there any way to do that? Thank you

    • Michal Sokolowski
      Michal Sokolowski almost 8 years
      May I ask for cat /proc/mdadm and mdadm --detail /dev/mdX? What distribution and version do you have there?
    • JasonAzze
      JasonAzze almost 8 years
      You might find some interesting information in the answers to this related, but not identical, question.