Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a software RAID 5 with 6 devices and one of them needs to be rebuilt. Until now, everything is OK.

But, while the disk is rebuilt, it was found bad sectors on another disk and is being marked as faulty. I can reassemble the RAID making mdadm --assemble --force /dev/sd[a-f].

So, I made an image of the faulty disk and filled the bad area with zeros. Then, I created a loop device with the command losetup.

When I try to assemble the RAID with loop device, I got an error issuing:

mdadm: failed to add /dev/loop0 to /dev/md/DATA: Invalid argument.

and a message in dmesg:

[ 3085.638028] mdadm: sending ioctl 1261 to a partition!
[ 3085.638044] mdadm: sending ioctl 1261 to a partition!
[ 3085.647487] md: loop0 does not have a valid v1.2 superblock, not importing!
[ 3085.647516] md: md_import_device returned -22

Is there any solution to this problem?

share|improve this question
3  
Yes, replace the bad drives and restore from your backups. –  Michael Hampton Jul 7 '13 at 20:06
3  
2 dead devices in a RAID5 will have you reaching for your backups once you have rebuilt the array preferably using a different RAID level. –  Iain Jul 7 '13 at 20:07
2  
The point of RAID is to reduce downtime. If you keep messing with it, you just increase downtime, defeating the point of using RAID in the first place. Just build a new RAID array and recover from a backup. –  David Schwartz Jul 7 '13 at 23:02
    
Sorry. Two bad drives in RAID 5 is... unpromising. I'm going to second (fourth?) the replace the drives and restore suggestion. :( –  Katherine Villyard Jul 7 '13 at 23:18
    
How did you back up the faulty drive? –  Nils Jul 8 '13 at 9:20
show 2 more comments

3 Answers

Forget it. Even if this would work - your data will be a mess.

As for the missing Superblock - I have no idea why it is missing if you did your copy with dd.

You could try to extract that info from the faulty disk with mdadm --misc -E /dev/yourdisk.

I suspect that that block might be buggy, too.

share|improve this answer
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  Dave M Jul 8 '13 at 12:40
    
@DaveM I disagree, this is the correct and only answer. His data is compromised, he's exceeded the resilience of RAID5 and he needs to move on. –  Dan Jul 8 '13 at 15:19
    
@DaveM I did both. I will extend my answer accordingly. –  Nils Jul 8 '13 at 15:30
add comment

I don't know why, the image of the faulty disk was incomplete. I recreated the image, then the loop device and reassembled the RAID. And to my surprise, everything is working perfectly. I know it isn't the best solution and data corruption may occur. But I think is good enough for me this solution.

Thanks for the help anyway :)

share|improve this answer
1  
You'll likely have unrecoverable read errors when rebuilding this array from any failures in the future. This will also make those backups worthless for recovering the RAID to a known good state. You should really really blow it away and restore from backup, using the image that you made to restore any file-level data that you may have lost since your last backups. That image should not be used for block-based recovery like you have. –  MDMarra Jul 8 '13 at 15:05
    
And consider your new RAID level to be 1+0 or 6. –  mfinni Jul 8 '13 at 15:40
add comment

No, there is no solution at this point.

A RAID 5 can by definition not work with more than one failed member: Heavily simplified, Data is partitioned in n-1 stripes (whereas n=count of raid members, here a disk), a parity will be calculated over these stripes and put on a remaining member. If a member fails, either an data slice or the parity will be lost, but not both - which allows you to reconstruct one from another.

But if you lose two members, original data is always lost when more than one disk fails, since both a slice and the parity is lost - the controller has absolutely no way to reconstruct this data.

There is a possibility to reconstruct parts of your data by means of traditional data rescue procedures if a member is not lost as a whole, but be prepared that your data will look like one has fired a shotgun at it.

P.S. Do not fiddle low-level with a RAID that is failing - this only serves to worsen your situation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.