One of our Disaster recovery services client had a hard drive fail. The harddisk was marked faulty and removed as well. Client inserted new HDDs, and needed us to rebuild the array. Hot swappable HDs would have done the job real quick. But not here. There is some process involved in rebuilding the array.
A normal array will have the output similar to below – Notice the [UU] – U could mean “Used”. A fully functional RAID system would show [UU] for each slice.
cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0] sdb1[1]
1052160 blocks [2/2] [UU]
A degraded array will look like,
cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdb2[1]
8385856 blocks [2/1] [_U]
_ means degraded array i.e partition missing from array.
Use fdisk to create partitions similar to the one working in the HDD. Using fdisk, then n , p t etc to recreate the partitions are not needed if you have sfdisk in the server.
sfdisk – Partition table manipulator for Linux
fdisk -l or cat /proc/mdstat will give you the device name which is active and the below command will give the partition table of sdb to part.sdb file
sfdisk -d /dev/sdb > part.sdb
sfdisk â-force /dev/sda < part.sdb
will copy the partition table to this new sda disk saving the time.
BE CAREFUL ON WHAT PARTITION TABLES ARE COPIED. Don’t copy unused drive’s partition table to the active one ð
Finally, once the partition table is copied, execute this
# mdadm –add /dev/md0 /dev/sda1
# mdadm –add /dev/md1 /dev/sda3
# mdadm –add /dev/md2 /dev/sda2
# mdadm –add /dev/md3 /dev/sda5
For any further assistance, you can always contact our Disaster recovery services team.