|
From: Bruce A. <ba...@gr...> - 2004-06-03 22:07:53
|
> I just ran across a bad sector (or sectors) that are on a disk on a > software raid5 array. > > I've read the bad blocks howto, but there's nothing about finding the > file associated with the block if its in an array. I imagine its > possible, and I'm willing to do some digging to do it, but I'd rather > not re-invent the wheel if someone else has already figured out the > right steps for it. You forwarded an email of mine to a list before, and > I went to the smartmontools.sf.net page to see if there were any SF > lists, but I couldn't find one, so I don't know what list that was... On about the tenth line of the page it says "Mailing List Information and Archives (Archive has Search Box in top left corner)." > From a data perspective, here's what I've got: > > 1) I have the LBA of the sector on disk (31338053) > > 2) I have the physical partition: > <deep-thought>/root # fdisk -lu /dev/hdm > > Disk /dev/hdm: 251.0 GB, 251000193024 bytes > 4 heads, 32 sectors/track, 3829959 cylinders, total 490234752 sectors > Units = sectors of 1 * 512 = 512 bytes > > Device Boot Start End Blocks Id System > /dev/hdm1 * 32 490234751 245117360 fd Linux raid autodetect > > What I'm missing at this point is: > 3) How do I get the /dev/md0 mapping of raid blocks to physical LBAs? I don't know how to do this. Probably the linux software RAID developers will know. > Then: > 4) Will changing that file actually change the physical block, or do I > need to do something indirect? I don't know if changing that file will change the physical block. My advice would be to identify the file associated with the block, and then to just write zero to that block on the physical device. Then delete the (corrupted) file and replace it. > Finally: > 5) What if the block isn't actually part of a file? I suspect that's its > actually not part of any file. I guess it depends. If the block is part of a file system (example: a directory) then you may need to do something special. If it's just an empty unused block, writing zeros to it to force reallocation will probably be fine. > I think what it may boil down to is that simply logically removing and > re-inserting the drive into the array, forcing a resync, will clear up > the sector, but that just seems so inelegant when it should be easy to > do something like this: > > 1) Find the raid block associated with the bad physical sector(s) > 2) Mark just the bad sectors dirty in the raid data structures > 2) re-sync just those physical sectors, causing the un-readable ones to > be written, and thus relocated. > > Does that make sense? Am I dreaming? No, it makes sense. Please correspond with the people who do software RAID, then add a few paragraphs to my BadBlockHowTo! Cheers, Bruce |