-1

Hello I want to rebuild my raid array and I found a page in the redhat documentation that says how to do this, but it doesn't seem to make sense.

Here's a link to the documentation The part I'm confused about is step 5:

" To restore the disk, perform a "software fail" the previous spare slice: mdadm --manage --set-faulty /dev/md0 /dev/sdc3 ". The system will now attempt to rebuild the array on the replaced disk.

Not only does this not make any sense in the English language, but I don't see how mdadm will automatically rebuild the array immediately after I've just set one of the disks to fail. Is this just a mistake in the documentation? Please help I'm confused. Can someone tell me if these instructions are correct before I ruin anything? Thanks.

  • Why don't you just try it on a scratch system first? – womble Aug 23 '18 at 23:49
  • I've already got the system set up. I just really want to know if the commands are right or not. It makes no sense to me and goes against all the other tutorials I've read. I don't see how can setting /sdc1 to faulty cause mdadm to rebuild the array using that disk, that command is used for removing discs and mdadm won't use a disc marked as faulty to rebuild the array, so how can they be correct? If someone can just simply look at the link and think logically I'd hope they can come to the same conlucusion. – Tom Aug 24 '18 at 0:22
  • Steps 5 and 7 don't seem to have any purpose except to cause the rebuild to happen twice. If you see in /proc/mdstat that the array is rebuilding or rebuilt, then you do not need to perform them. – Michael Hampton Aug 24 '18 at 1:41
2

I'm with you that the documentation is (at least) wrong.

DISCLAIMER: I do not own a RHEL system. I have extensive experience of Debian raid, from different Debian versions, but definitely never put my hands on a RHEL system. Please test this on a spare system (VM) before acting on a production machine.

This is what will happen:

  1. Remove the disk from the raid array.

    mdadm --manage /dev/md0 -r /dev/sdc3

The sdc3 partition will be expelled from the md0 array.

  1. Remove the disk from the system.

The entire sdc disk, amoung with its sdc3 partition, will not be anymore in the system, I assume "they" want us to simply "sit the failed sdc disk on the desk" for now.

  1. Using fdisk, replace the removed disk and re-format the replacement disk.

You connect a new sdc disk, then you re-partition it exactly like the failed one. At this point, a "sdc3 partition will exist again in the system

  1. Add the new disk back to the RAID array.

    mdadm --manage /dev/md0 -a /dev/sdc3

The sdc3 partition will be added to the array, and a resync will start automatically, and immediately. This is simply what it's needed to replace a failed disk. You simply have to wait for the resync to finish, by watching /proc/mdstat, and nothing more. But the documentation goes on.

  1. To restore the disk, perform a "software fail" the previous spare slice:

    mdadm --manage --set-faulty /dev/md0 /dev/sdc3

This will set the sdc3 partition as faulty, simulating a hardware fail. You will go back to before step 1, when you had the sdc3 partition failed.

  1. The system will now attempt to rebuild the array on the replaced disk. Use the following command to monitor status:

    watch -n 1 cat /proc/mdstat

Actually, no. The system will wait for your intervention, and you should now follow the steps 1-4 again. However, this command is the right one for monitoring the resync progress, with a 1-second updates. Press CTRL+C to exit from the watch process.

  1. When the array is finished rebuilding, remove and then re-add the software-failed disk back to the array.

    mdadm --manage /dev/md0 -r /dev/sdc3

    mdadm --manage /dev/md0 -a /dev/sdc3

Actually, these two commands will make the rebuild (resync) process start. They are exactly step 1 and 4 (steps 2 and 3 are not needed now, since the disk has not failed because of a real problem, but because of a simulated error). You now have to wait for the rebuild process to finish, monitoring /proc/mdstat.

  1. Check the array.

    mdadm --detail /dev/md0

This will give you more info about the md0 array, but nothing more about the resync process which you can already get from /proc/mdstat. Not needed at all.

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.