[clue-tech] props to whoever wrote the RAID1 md code in the kernel

Jim Ockers ockers at ockers.net
Thu Apr 16 14:43:44 MDT 2009


Hey CLUEbies,

I just want to give a shout out for posterity to whoever made the Linux
software RAID mirroring (RAID1) personality.  I lost my RAID mirror due
to a bunch of simultaneous hardware failures (controllers and interfaces
 - they were external USB enclosures on a NSLU2 slug fileserver).

It turned out the drives were OK but I thought I lost all the data
because for whatever reason the RAID superblock was invalid or blank on
all of the partitions on the drive.  Since I made the partitions I 
remembered what they were (root, boot, swap, data, etc).  Even the
swap partition was on a RAID mirror, ha ha.  Since it was just a slug
it didn't matter if it was set up stupid. :P

I put the drives in another box and hooked them up to the SATA controller.
I was looking at the swap partition of one of the drives in xxd hex 
editor trying to figure out what the actual physical data organization 
was, and I noticed the text SWAPSPACE2.  I was expecting some sort of
weird striping or block re-arrangement or some other weird organization
of data.

The existence of that SWAPSPACE2 text at the beginning of a RAID1 
partition made me think to try this:

[root at new etc]# file -s /dev/sdb3
/dev/sdb3: Linux rev 1.0 ext3 filesystem data (needs journal recovery) (large files)

HMMM that is supposed to be a RAID superblock but instead file thinks it
is a ext3 superblock.  e2fsck likes it, and so does mount, so I was able
to mount the RAID partition as an ext3 filesystem without activating the
RAID mirror.  Thus I recovered 750GB of data that I thought I had lost. :)

So the moral of the story is, Linux software RAID-1 mirroring appears to
be a simple copy of the blocks of data between the devices, so you can
access your data on either drive without necessarily starting the RAID
array.  I'm sure there are some drawbacks to this design (such as long
resync times in the absence of block checksums or something) but it's 
clear to me that there are some advantages too.

For what it's worth,
Jim

-- 
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: please see http://www.ockers.net/


More information about the clue-tech mailing list