Shell Script To Monitor Completion of RAID Assembly

VinnyD asked:

How can I pause execution of my shell script after calling the following command until the raid array has been assembled? From what I understand, this is an asynchronous process and status of the raid array needs to be polled.

mdadm –create -l10 -n4 /dev/md0 /dev/xvdh*

My answer:

Since you’re creating a new RAID 10, you can begin using the array immediately. The initial resync will continue in the background. You only need to wait for it to complete if building a RAID 5 array (and it’s a good idea for a RAID 6, too).

See Initial Array Creation in the Linux RAID Wiki for further details.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.