All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Turmel <philip@turmel.org>
To: Thorsten von Eicken <tve@voneicken.com>, linux-raid@vger.kernel.org
Subject: Re: mapping disk sectors to files
Date: Fri, 14 Mar 2014 08:13:05 -0400	[thread overview]
Message-ID: <5322F251.2080600@turmel.org> (raw)
In-Reply-To: <00000144bf42b0b6-2fe18839-c08d-4c8a-a358-a68135c6d340-000000@email.amazonses.com>

Good morning Thorsten,

On 03/14/2014 02:23 AM, Thorsten von Eicken wrote:
> I've just had a disk in a raid1 mirror set die and that exposed some bad
> block on the remaining drive -- ooops! I'd now like to map the bad
> blocks to files so I can restore the affected files from backups, but I
> can't figure out the mapping. What I've done:

[trim /]

> The GPT is:
> Disk /dev/sda: 3907029168 sectors, 1.8 TiB

>    3          935936      3907029134   1.8 TiB     FD00  Linux RAID

> The md device says:
> # mdadm --examine /dev/sda3
> /dev/sda3:
>           Magic : a92b4efc
>         Version : 1.2

>      Raid Level : raid1
> 
>     Data Offset : 2048 sectors

These key pieces of info tell you that the blocks in /dev/md0 start at
sector 2048 in /dev/sda3, which itself starts at sector 935936 of the
disk as a whole.  As a raid1, the blocks are 1:1 linear from there.

So all you've missed in your calculations is the 2048 sector offset of
the md data area.  Add that to your partition start value and you'll be
golden.

HTH,

Phil

      parent reply	other threads:[~2014-03-14 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  6:23 mapping disk sectors to files Thorsten von Eicken
2014-03-14  8:07 ` Eyal Lebedinsky
2014-03-14 12:13 ` Phil Turmel [this message]

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=5322F251.2080600@turmel.org \
    --to=philip@turmel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=tve@voneicken.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.