tricky raid-1 recovery problem

Jack Howarth howarth at
Tue Aug 17 16:34:28 UTC 2004

   To answer my own question, the solution to the problem of
attempting to use a mirror drive whose partition had been
partially resynced against a master mirror drive with bad blocks
was as follows. Since the /home partition had fortunately not
been written to since the last reboot, the slave mirror was still
intact although the superblock for the md was now wrong because
of the partial resync for that md. The other four md's had
properly resynced because the master mirror drive didn't have
bad blocks in their range. The solution, for a /dev/md4 which
consisted of a /dev/sda6 and /dev/sdb6 partitions...

1) pull the bad sda drive and allow sdb to become the sda master.
2) since the md4 partition had a partial resync, disable it with
      mdadm -S /dev/md4
3) Mount the partition as read-only at /dev/sda6, back up the
   data and then umount /dev/sda6 again
4 ) zero out the md superblock with...
      mdadm --zero-superblock /dev/sda6
5) recreate the raid-1 mirror leaving space for the replacement
   drive to be added later...
      mdadm --create /dev/md4 --level=1 --raid-devices=2 /dev/sda6 missing
6) now mount /dev/md4 and do a fsck on it. I saw no errors.
7) add in a replacement second drive and hot-add all the md partitions...
      mdadm -a /dev/md4 /dev/sda6
      mdadm -a /dev/md1 /dev/sdb2

Each drive should resync properly off of the master mirror at this point.

More information about the users mailing list