All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Goryachev <adam@websitemanagers.com.au>
To: d tbsky <tbskyd@gmail.com>, linux-raid@vger.kernel.org
Subject: Re: data corruption after rebuid
Date: Thu, 14 May 2015 16:00:20 +1000	[thread overview]
Message-ID: <555439F4.4020200@websitemanagers.com.au> (raw)
In-Reply-To: <CAC6SzHKo8kUOJoC+eaZU1mQCzW+WdB6ACRkrM30yUCA7CodLCQ@mail.gmail.com>

On 14/05/15 14:54, d tbsky wrote:
> Hi:
>      I think I did something wrong and cause mdadm data corruption.
> but I am curious which steps brings me down. hope someone can told me
> about it.
>
>        I have two hosts forms a vm HA cluster. each one is a 2TB * 2
> mdadm raid 1. I need to test something but lack of disks, so I pull
> one disk of each hosts.  after testing, I put the disk back and let
> mdadm rebuild. host B took several hours to rebuild and looks fine.
> host A took only 5 min to rebuild. after completing rebuild, the
> virtual machines stand  above the raid crashed one by one. since I
> know I have write many data  bytes during the testing, host A should
> not took only 5 min to recover. I must do something wrong to confuse
> mdadm.  below is what I done:
>
> 1. I test a 3 disk mdadm raid 5: sda (hostA sdb), sdb (hostB sdb), sdc
> (new disk). I wrote about 5G data for system restore testing.
>
> 2. then I test a 4 disk mdadm raid10: sda (hostA sdb), sdb(hostB
> sdb),sdc(new disk),sdd (new disk). I wrote about 5G data for system
> restore testing.
>
> 3. then I test again a  4 disk mdadm rai10, but wrote about 120G data
> for system restore testing.
>
> then I put back the disk to hostA and hostB (hot plugin, HOST A and B
> are still running). at hostA I issue command blow:
>    mdadm --stop /dev/md126; mdadm --stop /dev/md127 (the plugged disk
> has raid data on it and udev seems found it)
>    dd if=/dev/sda of=/dev/sdb bs=1k count=1000  (to recreate mbr
> partition table).

My guess is this is where you went wrong.
Instead use a tool that will do this intelligently, quick google shows this:
sgdisk -R=/dev/sdb /dev/sda
sgdisk -G /dev/sdb
Taken from:
http://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools

My guess is you copied some data as well as the partition table, and
that you are using a mdadm label which is stored at the beginning of the
disk, and possibly are using bitmap on one server and not the other.

Maybe if you could show some details from each of the raid arrays then
more people can make more informed comments.

My suggestion is to create *just* the partitions, and then add them to
the array.

Hope that helps.

Regards,
Adam

-- 
Adam Goryachev
Website Managers
Ph: +61 2 8304 0000                            adam@websitemanagers.com.au
Fax: +61 2 8304 0001                            www.websitemanagers.com.au


  reply	other threads:[~2015-05-14  6:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14  4:54 data corruption after rebuid d tbsky
2015-05-14  6:00 ` Adam Goryachev [this message]
2015-05-14  6:36   ` d tbsky

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=555439F4.4020200@websitemanagers.com.au \
    --to=adam@websitemanagers.com.au \
    --cc=linux-raid@vger.kernel.org \
    --cc=tbskyd@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.