Re: mapping disk sectors to files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux