linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Klauer <Andreas.Klauer@metamorpher.de>
To: Wolfgang Denk <wd@denx.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: MD RAID6 corrupted by Avago 9260-4i controller
Date: Sun, 15 May 2016 17:31:21 +0200	[thread overview]
Message-ID: <20160515153121.GA11365@EIS.leimen.priv> (raw)
In-Reply-To: <20160515133740.85EC3100879@atlas.denx.de>

On Sun, May 15, 2016 at 03:37:40PM +0200, Wolfgang Denk wrote:
> Trying to follow the overlay method in [1], I run into errors; guess I
> must be missing something:
>
> [1] https://raid.wiki.kernel.org/index.php/Recovering_a_failed_software_RAID#Making_the_harddisks_read-only_using_an_overlay_file

I think you mixed two approaches to the same thing, the wiki shows
a) how to create overlays manually and b) offers some convenience 
functions that do the same thing (the overlay create remove functions, 
you define those functions once and then you can repeatedly call them, 
basically giving you two commands overlay_create and overlay_remove).

It should work if you use only this part:

> # devices="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf"
> # overlay_create()
> > {
> >         free=$((`stat -c '%a*%S/1024/1024' -f .`))
> >         echo free ${free}M
> >         overlays=""
> >         overlay_remove
> >         for d in $devices; do
> >                 b=$(basename $d)
> >                 size_bkl=$(blockdev --getsz $d) # in 512 blocks/sectors
> >                 # reserve 1M space for snapshot header
> >                 # ext3 max file length is 2TB   
> >                 truncate -s$((((size_bkl+1)/2)+1024))K $b.ovr || (echo "Do you use ext4?"; return 1)
> >                 loop=$(losetup -f --show -- $b.ovr)
> >                 # https://www.kernel.org/doc/Documentation/device-mapper/snapshot.txt
> >                 dmsetup create $b --table "0 $size_bkl snapshot $d $loop P 8"
> >                 echo $d $((size_bkl/2048))M $loop /dev/mapper/$b
> >                 overlays="$overlays /dev/mapper/$b"
> >         done
> >         overlays=${overlays# }
> > }
> # overlay_remove()
> > {
> >         for d in $devices; do
> >                 b=$(basename $d)
> >                 [ -e /dev/mapper/$b ] && dmsetup remove $b && echo /dev/mapper/$b 
> >                 if [ -e $b.ovr ]; then
> >                         echo $b.ovr
> >                         l=$(losetup -j $b.ovr | cut -d : -f1)
> >                         echo $l
> >                         [ -n "$l" ] && losetup -d $(losetup -j $b.ovr | cut -d : -f1)
> >                         rm -f $b.ovr &> /dev/null
> >                 fi
> >         done
> > }

And then call 'overlay_create' when you want your overlays, 
and 'overlay_remove; overlay create' when an experiment 
failed and you want to reset them to their original state.

At the time you remove the overlays, all things using them 
must also be gone, so mdadm --stop before overlay_remove. 
(And make sure no raid is running for the disks you're 
overlaying...)

As for your controller, I don't know this controller. If it's a HW-RAID 
that passes individual disks through as RAID-0, usually some sectors of 
the disk are missing (controller has to keep RAID-0 metadata somewhere) 
and that alone might be enough to damage your old setup in some way.

I prefer "dumb" controllers that pass through disks the way they are.

You showed --detail output of your old RAID; that's already very good, 
is there --examine output by any chance? --detail doesn't contain some 
things such as data offsets, and the ones mdadm picks by default have 
changed a lot, so the same --create command won't actually produce 
the same RAID. If your old RAID metadata is actually lost, if you wish 
to experiment with --create on the overlay, you'll have to specify all 
variables you know and guess the variables you don't know...

Regards
Andreas Klauer

  reply	other threads:[~2016-05-15 15:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-15 12:45 MD RAID6 corrupted by Avago 9260-4i controller Wolfgang Denk
2016-05-15 13:37 ` Wolfgang Denk
2016-05-15 15:31   ` Andreas Klauer [this message]
2016-05-15 18:25     ` MD RAID6 corrupted by Avago 9260-4i controller [SOLVED] Wolfgang Denk
2016-05-15 18:31       ` Andreas Klauer
2016-05-15 19:35         ` Wolfgang Denk
2016-05-15 20:34           ` Andreas Klauer
2016-05-15 23:10             ` Wolfgang Denk
2016-05-16  8:39               ` Andreas Klauer
2016-05-16 10:06                 ` Wolfgang Denk
2016-05-16 10:24                   ` Andreas Klauer
2016-05-16 11:05                     ` Wolfgang Denk
2016-05-16 12:06                 ` Wolfgang Denk
2016-05-16 12:58                   ` Wolfgang Denk
2016-05-16 13:14                     ` Andreas Klauer
2016-05-17 18:42                       ` Wolfgang Denk

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=20160515153121.GA11365@EIS.leimen.priv \
    --to=andreas.klauer@metamorpher.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=wd@denx.de \
    /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).