Locate and Replace Bad Drive
In this guide, /dev/sdb will be our faulty drive.
Below, we can see that /dev/sdb has failed
[root@MyServer ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb2[1](F) sda2[0]
204736 blocks super 1.0 [2/2] [_U]
md1 : active raid1 sdb3[1](F) sda3[0]
112852864 blocks super 1.1 [2/2] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
unused devices:
Locate the serial number that will be printed on the bad drive
hdparm -I /dev/sdb | grep Serial
Power off the server and replace the problem drive. It should have the serial number we just found printed on it
Prepare New Drive
Power the server back on and install gdisk
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noargdisk ch.rpm yum install gdisk -y
Backup the partition table of our remaining good drive (/dev/sda)
gdisk /dev/sda
Press b for backup and type “sda.part” when prompted to enter a filename
Press q to quit
Copy sda's partition table onto our new drive (/dev/sdb)
gdisk /dev/sdb
Press r for recovery
Press l (lower case L) and type “sda.part” when prompted for the filename of your backup
Press w to write changes
Confirm that the partition table on both disks are matching
parted -l
Reboot the server
Restore RAID Array
mdadm --manage /dev/md0 --add /dev/sdb1 mdadm --manage /dev/md1 --add /dev/sdb2
Confirm that the new disk was added to the array correctly
cat /proc/mdstat
You should see something like this
Personalities : [raid1]
md0 : active raid1 sdb2[1] sda2[0]
204736 blocks super 1.0 [2/2] [UU]
md1 : active raid1 sdb3[1] sda3[0]
112852864 blocks super 1.1 [2/2] [UU]
bitmap: 1/1 pages [4KB], 65536KB chunk
unused devices:- Updated