[linux-lvm] badblocks handling with LVM

Andreas Dilger adilger at turbolinux.com
Fri Apr 27 23:59:33 UTC 2001


Russel Coker writes:
> On Monday 23 April 2001 12:08, Andreas Dilger wrote:
> > As long as the bad blocks are not in the first ~250kB of the partition/disk
> > then LVM doesn't care about it.  However, reiserfs doesn't yet support bad
> > blocks in the filesystem (this is currently under development AFAIK), so
> > this will not help you.
> 
> The problem is that when you move LV's around and make snapshots the bad 
> blocks on the underlieing media will move.  Therefore I think that management 
> of bad blocks possibly should be done in the LVM.

As long as the LVM metadata and the snapshotted blocks themselves don't hit
more bad blocks, the snapshot itself will be fine.  ext2 just allocates all
of the bad blocks to a file, and presumably this file gets no I/O, so just
doing a snapshot of a filesystem with bad blocks is not an issue.

This leaves several other alternatives:
- New LV has bad blocks: no different than bad blocks in a partition, so
  a new ext2 filesystem can handle this via badblocks(8).
- Extended LV has bad blocks in added PEs: you can run badblocks(8) on the
  newly allocated part of the LV (specify a start block) before fs extend
  (can't use e2fsadm in this case).
- pvmove a filesystem to PEs with bad blocks: you are mostly screwed.  If
  you _really_ wanted, you could run badblocks on the PEs (added to a temp
  LV), keep a list of bad blocks, add them to the ext2 filesystem (with
  appropriate math for their new offset inside the LV, etc) before the PE
  is moved, but it is very ugly.  As someone else suggested, you could
  simply add the entire PE to "lvbad", and simply not use them.  If you
  have so many PEs with bad sectors that it uses up a large part of your
  device, it is time to get a new disk (or use RAID with 2 semi-bad disks
  and hope that they don't have 2 bad sectors in the same place).

Cheers, Andreas
-- 
Andreas Dilger                               TurboLabs filesystem development
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/



More information about the linux-lvm mailing list