Repair Misbehaving Software RAID 5 Array

The Musing

Not really a musing, as much as I wanted to document this fix, because it seems to happen with alarming frequency.

The Situation

I run a Mythbuntu box to as a PVR – it works great! I recently created a software RAID array using mdadm with three disks. Sometimes when the power goes off and the machine doesn’t shutdown cleanly, it won’t boot, and I have to scurry around the interwebs to try and figure out how to repair the degraded array. This may not work for you, but it works in my case. Most of the time.

The Fix

Typically, I will repeatedly press Esc on boot to get the grub boot screen, and boot into a recovery kernel. This usually fails into an intramfs prompt complaining that the RAID array can’t assemble.

Going from this post, I force it to assemble using

# mdadm -A -s --force

The offending device is typically /dev/md1, which is made up of sda2, sdb2, and sdc2. /dev/md0 hasn’t given me that much trouble, but it’s made up of sda1, sdb1, sdc1.

Update 10/2020: The most recent error I received was that /dev/md1 showed that “found some drive for an array that is already active”. I used:

# mdadm --stop /dev/md1
# mdadm -A -s --force
# mdadm --start /dev/md1
# reboot

Leave a Reply