Replace failed hard drive in raid array

When a hard drive in raid has failed then it’s very important to replace it immediately. Now suppose you have a raid1 array and with two disk /dev/sdc1 and /dev/sdd1. And the /dev/sdd1 has failed. Now to replace the drive

First set it to fail and remove it.

[bash]
mdadm –manage /dev/md3 –fail /dev/sdd1
mdadm –manage /dev/md3 –remove /dev/sdd1
[/bash]

Now shutdown the system , and replace the the hard drive in slot. And start the server again.

Now create the partition of exactly same size as that of /dev/sdc1

fdisk /dev/sdd

Now add the drive back to the raid

mdadm --manage /dev/md3  --add /dev/sdd1

Now check the /proc/mdstat for status

[root@server2 ~]# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sdd1[1] sdc1[0]
      2930263928 blocks super 1.2 [2/2] [UU]
      [==>..................]  resync = 14.4% (422775040/2930263928) finish=287.7min speed=145253K/sec

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


5 × = thirty