archive mirror
 help / color / mirror / Atom feed
From: Lars Ellenberg <>
Subject: Re: [linux-lvm] How to handle Bad Block relocation with LVM?
Date: Thu, 29 Nov 2012 15:04:01 +0100	[thread overview]
Message-ID: <20121129140401.GE674@soda.linbit> (raw)
In-Reply-To: <k97k9f$6kf$>

On Thu, Nov 29, 2012 at 07:26:24AM -0500, Brian J. Murrell wrote:
> On 12-11-28 08:57 AM, Zdenek Kabelac wrote:
> > 
> > Sorry, no automated tool.
> Pity,
> > You could possibly pvmove separated PEs manually with set of pvmove
> > commands.
> So, is the basic premise to just find the PE that is sitting on a bad
> block and just pvmove it into an LV created just for the purpose of
> holding PEs that are on bad blocks?
> So what happens when I pvmove a PE out of an LV?  I take it LVM moves
> the data (or at least tries in this case) on the PE being pvmoved onto
> another PE before moving it?
> Oh, but wait.  pvmove (typically) moves PEs between physical volumes.
> Can it be used to remap PEs like this?

So what do you know?
You either know that pysical sector P on some physical disk is broken.
Or you know that logical sector L in some logical volume is broken.

If you do
pvs --unit s --segment -o vg_name,lv_name,seg_start,seg_size,seg_start_pe,pe_start,seg_pe_ranges

That should give you all you need to transform them into each other,
and to transform the sector number to PE number.

Having the PE number, you can easily do
pvmove /dev/broken:PE /dev/somewhere-else

Or with alloc anywhere even elsewhere on the same broken disk.
# If you don't have an other PV available,
# but there are free "healthy" extents on the same PV:
# pvmove --alloc anywhere /dev/broken:PE /dev/broken
Which would likely not be the smartest idea ;-)

You should then create one LV named e.g. "BAD_BLOCKS",
which you would create/extend to cover that bad PE,
so that won't be re-allocated again later:
lvextend VG/BAD_BLOCKS -l +1 /dev/broken:PE

Better yet, pvchange -an /dev/broken,
so it won't be used for new LVs anymore,
and pvmove /dev/broken completely to somewhere else.

So much for the theory, how I would try to do this.
In case I would do this at all.
Which I probably won't, if I had an other PV available.


I'm unsure how pvmove will handle IO errors, though.

> > But I'd strongly recommend to get rid of such broken driver quickly then
> > you loose any more data - IMHO it's the most efficient solution cost &
> > time.



  reply	other threads:[~2012-11-29 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-14  8:52 [linux-lvm] Re: How to handle Bad Block relocation with LVM? Eric Hopper
2003-02-14 11:27 ` Joe Thornber
2012-11-28 13:27   ` [linux-lvm] " Brian Murrell
2012-11-28 13:57     ` Zdenek Kabelac
2012-11-29 12:26       ` Brian J. Murrell
2012-11-29 14:04         ` Lars Ellenberg [this message]
2012-11-29 22:53           ` Brian J. Murrell
2012-11-29 15:55       ` Stuart D Gathman
2012-11-30  0:10         ` Brian J. Murrell
  -- strict thread matches above, loose matches on Subject: below --
2023-03-15 16:00 Roland
2003-02-10 19:18 Rocky Lee
2003-02-11  8:24 ` Heinz J . Mauelshagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121129140401.GE674@soda.linbit \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).