web analytics


Rebuilding Software RAID

Tags: mdadmRAIDrebuild arraysoftware raid

Published on: December 17, 2009 by George K.

Rebuilding Software RAID


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.

Category : Linux

George K.

George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.

You may also read:


Add new commentSIGN IN

Let's Connect

Get new updates


$0.000 items