linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Mikael Abrahamsson <swmike@swm.pp.se>
Cc: Marc MERLIN <marc@merlins.org>, linux-raid@vger.kernel.org
Subject: Re: How to force rewrite of a smart detected bad block with raid5: checkarray?
Date: Wed, 19 Jan 2011 20:41:15 +1100	[thread overview]
Message-ID: <20110119204115.0fe4b159@notabene.brown> (raw)
In-Reply-To: <alpine.DEB.1.10.1101190842170.13151@uplift.swm.pp.se>

On Wed, 19 Jan 2011 08:42:53 +0100 (CET) Mikael Abrahamsson
<swmike@swm.pp.se> wrote:

> On Tue, 18 Jan 2011, Marc MERLIN wrote:
> 
> > Does this actually do what I want? Try all the blocks on each drive and 
> > if one block is unreadable, it forces a rewrite on the bad drive using 
> > the n-1 other ones to recreate it?
> 
> You want to use the "repair" command. This has been discussed numerous 
> times and discussions regarding it can be found in the archives.
> 

No, he actually wants the 'check' command, though 'repair' would work too.

All you need to do is get md/raid5 to try reading the bad block.  Once it does
that it will get a read error and automagically try to correct it.

You could do the math, figure out where in the array the bad block is and use
e.g. dd to just read that block.  That could work, but if the block is a
parity block, then it probably won't.

'check'  (i.e. echo check > /sys/block/mdXX/md/sync_action) will cause
md/raid5 to read all blocks on all devices, thus auto-repairing any
unreadable blocks.

'repair' will also do that but if it find that the parity looks wrong, it
will try to correct the parity.  It is generally best to only use 'repair'
when you have good reason to believe that you need it.


If you were really keen, you could 
  cd /sys/block/mdXX/md
  echo 3907029168 > sync_min
  echo 3907029170 > sync_max
  echo check > sync_action

and it will just sync that stripe.
Though you need to adjust for any Data Offset if using 1.1 or 1.2 metadata,
and you might need to round both numbers of to the next page or maybe next
chunk, I'm not sure.

NeilBrown

  reply	other threads:[~2011-01-19  9:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19  7:04 How to force rewrite of a smart detected bad block with raid5: checkarray? Marc MERLIN
2011-01-19  7:42 ` Mikael Abrahamsson
2011-01-19  9:41   ` NeilBrown [this message]
2011-01-19 17:31     ` Marc MERLIN
2011-01-19 20:58       ` NeilBrown
2011-01-19 21:03         ` Marc MERLIN
  -- strict thread matches above, loose matches on Subject: below --
2011-01-19 18:36 Richard Scobie
2011-01-19 18:49 ` Marc MERLIN
2011-01-19 20:01   ` NeilBrown
2011-01-19 20:57     ` Marc MERLIN
2011-01-20  0:30       ` Richard Scobie

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20110119204115.0fe4b159@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=marc@merlins.org \
    --cc=swmike@swm.pp.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).