[linux-lvm] Bad block detection

Martijn Schoemaker lvm at shoenix.net
Thu May 20 10:36:36 UTC 2004


Hi all,

Dunno if this is the right place to put in this issue, but it has some
relation at least.

I run on a system with two 40Gb Maxtor hdd's. There are three partitions,
one boot which is mirrored using plain md, one swap which is also mirrored
with plain md and one partition with the rest of the diskspace which is
mirrored with md and brought completely under LVM. In this all my file-
systems (including root) lie.

Recently the LVM partitions on my first drive generated an
unrecoverable IO error (bad block). No problem, the mirror worked fine
so I ordered a new (exactly same) disk and swapped them out. While
syncinc the new disk another bad sector was encountered on the remaining
drive! Yep, this sucked bigtime since the mirror sync just restarted from
scratch. Fortunately my maxtor tools allowed me to 'repair' (swap out the
sector with a spare one) the problem so I could at least sync everything
to my new and faultless drive. Also, luckily the md software was so smart
not to mark my only remaining disk as 'faulty' otherwise I would have
been restoring backups ....

This second bad sector was in an LVM region which was not yet used, there-
for it was never detected. Since it was located in an unused section I was
lucky otherwise I would have had data corruption. (just imagine what would
have happened if I tried to add an LV while running on one disk!)

My question is, how can you prevent this ? I was personally thinking about
doing a badblock check every now and then to assure there are no lurking
problems. It would be nice to put in some sanity scanning feature in either
LVM or md so you can periodically scan for prone errors so you dont run
into problems when another disk is already failing. Or should you do it
yourself using cron or whatever ?

In my case I just was extremely lucky, but this is both a warning and a
query to see how you all think this could be prevented.

Cheers,
Martijn Schoemaker






More information about the linux-lvm mailing list