I have to recover my md0 RAID software with linux.

Today I've bought 4 disks,all new,all the same type and size.

I have removed the old disk using:

mdadm /dev/md0 --fail /dev/sdd2
mdadm /dev/md0 --remove /dev/sdd2

changed with the new ones:

mdadm /dev/md0 --add /dev/sdd2

Waited for rebuild and it works

Same thing for disk n°3 (sdc2)

On the sdb2 change the RAID started to give a lot of errors,"sector read failed etc" but not on sdb2, but on sdc2 when sdb2 was rebuilding! Then the system put my ext4 raid in R/O mode.

So I rebooted in single user mode(slackware can from initrd) and try to rebuild,of course before removing sdc2(faulty disk) and sdb2(incomplete resync).

I put the old sdb2 disk and tried to start; the array failed. Tried to add sdb2 to the array; itfailed, and told me to stop and reassemble.

I did

mdadm --stop /dev/md0 
mdadm /dev/md0 --assemble /dev/sda2 /dev/sdb2 /dev/sdd2

I want to start with 3 disks,then add sdc2 and complete the array. But it failed considering the sda2 and sdd ok,but mark sdb2 as..removed. How to readd sdb2 and rebuild my array?

  • Now is a good time to realise that RAID is not a Backup. If you had lost the content of the raid, would you have been able to recover? – Criggie Nov 10 '16 at 6:35
  • I know raid is not a backup,but save only from disk crash,the problem happen when you have 4 disk,replace 1 for increase size(then I will replace other 3),but during the resync one of the disk fault!So 1 fault,1 resync=2 4-2 =2 and raid5 don't start with two disk :),fortunately i didn't wipe the old disk and i can rebuild the raid,p.s=i know i can use two spare disk on raid5 but my server has only 4 slot – elbarna Nov 10 '16 at 6:43

Solution found,the old sdb2 was marked as faulty so the only solution was/is:

Boot from livecd or from initrd, and do:

mdadm /dev/md0 --stop 
mdadm /dev/md0 --assemble --force /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2

This will add all disks except the "faulty" drive, but will start md0

Then we will add the missing drive:

mdadm /dev/md0 --add /dev/sdb2

The array is reconstructing then, and the system works by now.

WARNING: after this "procedure" i've lost my lvm,because lvm don't recognize the md0 anymore,pvscan give error(id changed or something) so the best solution is..backup.

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.