Skip to contentSkip to conversation

Raid5 with 2 bad drives

DISCUSSION Matthias Julius 4 participants 5 messages Feb 22, 2005 – Feb 23, 2005 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi,

I have a raid5 out of 4 drives where 2 drives failed and were removed. Since it happened during backup I would very much like to reactivate the array to rescue as much data as there are intact.

When I try to assemble the array with mdadm it tells me that there are not enough devices. Is there a way to convince mdadm to use the faulty drive to get a working array?

Matthias

#1 lore raw
Quoted 9 lines · Matthias Julius

Hi,

I have a raid5 out of 4 drives where 2 drives failed and were removed. Since it happened during backup I would very much like to reactivate the array to rescue as much data as there are intact.

When I try to assemble the array with mdadm it tells me that there are not enough devices. Is there a way to convince mdadm to use the faulty drive to get a working array?

Try something like:

  mdadm --assemble /dev/mdY /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 \
	--run --force

Substitute the mdY and the /dev/sd?? for your devices as appropriate..

As for getting the data off, you have to be carefull you don't hit the bad blocks again.. You might be able to mount it read-only, then tar up the filesystem, directory at a time, hoping you don't hit a bad-block inside a file.

Gordon

#2 lore raw
Quoted 4 lines · Gordon Henderson

Try something like:

  mdadm --assemble /dev/mdY /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 \
	--run --force

--force did the trick. I could have thought of that one myself. Thanks.

As for not hitting the bad blocks again: Is there a way to find out to which file they belong with ext3/xfs on LVM on RAID5? That would be helpfull.

Matthias

#3 lore raw

I posted a raid5 parity calculator implemented in perl a while back (a couple weeks?) that is capable of taking your disk geometry, the RAID LBA you're interested in, and finding the disk sector it belongs to.

I honestly don't remember if it can go the other way, but I'm not sure why it couldn't? Its possible that bad blocks may simply be in the parity chunk of the stripe too. Once you've got the RAID LBA you can use the methods in the BadBlockHowto to find the file

Either way, the math isn't too hard, and the script isn't very complicated, but doing that math is the only way I know of to relate the bits of data you've got to the file.

-Mike

Quoted 22 lines · Matthias Julius
Quoted 4 lines · Gordon Henderson

Try something like:

 mdadm --assemble /dev/mdY /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 \
	--run --force

--force did the trick. I could have thought of that one myself. Thanks.

As for not hitting the bad blocks again: Is there a way to find out to which file they belong with ext3/xfs on LVM on RAID5? That would be helpfull.

Matthias

-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 8 lines · Mike Hardy

I posted a raid5 parity calculator implemented in perl a while back (a couple weeks?) that is capable of taking your disk geometry, the RAID LBA you're interested in, and finding the disk sector it belongs to.

I honestly don't remember if it can go the other way, but I'm not sure why it couldn't? Its possible that bad blocks may simply be in the parity chunk of the stripe too. Once you've got the RAID LBA you can use the methods in the BadBlockHowto to find the file

That helps. Although there is a typo in line 139. See diff below.

When I know the RAID LBA how do I find out to which LV it belongs and which sector it is in there? But, I guess I better ask that on a LVM list.

Matthias

raid5calc 2005-02-23 08:30:12.673100526 -0500 renamed from raid5calc.orig 2005-02-23 08:26:43.721332354 -0500 +1 -1
@@ -136,7 +136,7 @@
 # Testing only -
 # Check to see if the result I got is the same as what is in the block
 open (DEVICE, "<" . $component{"device"})
-    || die "Unable to open device " . $compoent{"device"} . ": " . $! . "\n";
+    || die "Unable to open device " . $component{"device"} . ": " . $! . "\n";
 seek(DEVICE, $device_offset, 0)
     || die "Unable to seek to " . $device_offset . " device " . $xor_devices{$i} . ": " . $! . "\n";
 read(DEVICE, $data, ($sectors_per_chunk * 512))