search cancel

Error while selectively rebuilding RAID array using 'mdadm add' command


Article ID: 167837


Updated On:




An error may occur if the sda or sdb for the specific md# you are trying to rebuild is in Failed (F) status. In such a case, you would need to run 'mdadm remove' and then run 'mdadm add'Here is an example output of 'cat /proc/mdstat' showing the RAID status:
[[email protected] admin]# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]

md5 : active raid1 sdb5[2](F) sda5[0]
8008256 blocks [2/1] [U_]

md6 : active raid1 sdb6[1] sda6[0]
236002752 blocks [2/2] [UU]

Notice the (F) against sdb for md5 in the output above.


If the sda or the sdb for a specific md# is in failed state, then an error occurs stating the device or resource busy while performing the rebuild using 'mdadm add' command as per the instructions in article 3808.

In the example above, the following error is seen:

[[email protected] admin]# mdadm -a /dev/md5 /dev/sdb5
mdadm: Cannot open /dev/sdb5: Device or resource busy
[[email protected] admin]#


1. Perform 'mdadm remove' for the failed sda/sdb

In the example above:
[[email protected] admin]#mdadm --remove /dev/md5 /dev/sdb5

2. Then perform 'mdadm add'
In the example above, the command would be:
[[email protected] admin]#mdadm --add /dev/md5 /dev/sdb5