public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Wynn Wolf Arbor <wolf@oriole.systems>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Trouble with backup harddisks
Date: Thu, 30 Apr 2020 21:27:13 +0200	[thread overview]
Message-ID: <20200430192713.ptlo7crtwvskse7n@nabokov.fritz.box> (raw)
In-Reply-To: <20200430180839.iz4kxipst2i5stwp@solfire>

All the following assuming that the disk was originally partitioned as 
GPT, but after that exclusively accessed as an MBR disk.

>PT fdisk (gdisk) version 1.0.5
>
>Caution: invalid main GPT header, but valid backup; regenerating main header
>from backup!

This makes sense since the GPT backup at the very end of the disk would 
most likely still be intact. gdisk identifies it correctly, but assumes 
(wrongly) that the data on the disk is governed by the GPT layout.

Since the disk was only ever accessed through an operating system that 
knew solely about MBR, the GPT data meant nothing to it. It happily 
wrote data past the MBR headers. Because the protective MBR is 
positioned before GPT information, the primary GPT header was destroyed 
and most likely overwritten with the file system. See also [1], the 
actual file system data probably begins somewhere past LBA 0.

>Caution! After loading partitions, the CRC doesn't check out!
>Warning: Invalid CRC on main header data; loaded backup partition table.
>Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
>on the recovery & transformation menu to examine the two tables.

This is because the backup GPT written when first partitioned does no 
longer match the data present at the very beginning of the disk.

If the initial assumption is correct, GPT *must not* be restored. Your 
modern PC sees the GPT partition type and assumes the existence of a 
GPT. It should, however, access the MBR layout and interpret the 
partition marked with the GPT ID as a regular partition.

Now, how to fix this?

Like Andrea already said earlier: 

> Since the disk is only 1TB, there is no reason to use GPT at all, so 
> your best bet is to use fdisk to make that a standard MBR by changing 
> the partition type from 'ee' to '83'. 

This would *not* repartition or reformat any data, it would simply tell 
your modern operating system to access the protective partition as a 
regular one.

It would, however, require writing the new type to disk. What you could 
do to be more safe here is to take a backup of the first 512 bytes with 
`dd', then change the partition ID with `fdisk', and try mounting it.

If it works, great. If not, you can restore the first 512 bytes of the 
disk with the backup.

>"fix manually" scares me...especially because I have no place for
>1TB of an image file to with which I can experiment ...

>Any ideas which could ease my burden and to un-scare my
>"need to fix it manually" ??? ;) ;)

There's a few alternatives:

1) Boot an older system that only understands MBR, and mount the disk 
there. This was suggested earlier but was dismissed because we assumed 
the sector size had something to do with it. I do not think this is the 
case anymore - the old system should be able to read it.

2) Boot a VM with a kernel that only understands MBR, pass USB through 
to the virtual machine, mount the disk there.

3) Try confirming that there exists file system data past the MBR header.

Maybe something like this:

# dd if=/dev/sdb of=sdb-data bs=512 skip=1 count=16384
$ file sdb-data

As established, the block size is 512 bytes. We skip the first 512 bytes 
since that is the protective MBR. sdb-data should then contain the first 
8MiB worth of actual file system data. The `file' utility can tell you 
what kind of data it is.

[1] https://en.wikipedia.org/wiki/GUID_Partition_Table#/media/File:GUID_Partition_Table_Scheme.svg

-- 
Wolf


  reply	other threads:[~2020-04-30 19:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30  9:32 [gentoo-user] Trouble with backup harddisks tuxic
2020-04-30  9:55 ` Wols Lists
2020-04-30 10:36   ` tuxic
2020-04-30 12:17     ` Wols Lists
2020-04-30 13:10       ` Wynn Wolf Arbor
2020-04-30 17:04         ` tuxic
2020-04-30 17:21           ` Wynn Wolf Arbor
2020-04-30 19:32           ` antlists
2020-05-01  1:59             ` tuxic
2020-05-01  8:03               ` tuxic
2020-05-01 20:27                 ` antlists
2020-05-02  1:42                   ` tuxic
2020-05-02 17:31                     ` Wols Lists
2020-05-02 17:49                       ` tuxic
2020-05-02 17:55                       ` tuxic
2020-04-30 13:44   ` Andrea Conti
2020-04-30 18:08     ` tuxic
2020-04-30 19:27       ` Wynn Wolf Arbor [this message]
2020-04-30 19:46         ` tuxic
2020-04-30 19:59           ` Wynn Wolf Arbor
2020-04-30 20:21         ` Andrea Conti
2020-04-30 20:47           ` Wynn Wolf Arbor
2020-05-01  5:07             ` tuxic
2020-05-01  6:52               ` Andrea Conti
2020-05-01  7:18                 ` tuxic
2020-05-01 10:27                   ` Wynn Wolf Arbor
2020-05-01 16:00                   ` Andrea Conti
2020-05-01 16:32                     ` Peter Humphrey
2020-05-02  2:03                       ` tuxic
2020-05-02  7:49                         ` Andrea Conti
2020-05-02  8:39                           ` tuxic
2020-05-02  9:23                             ` Michael

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=20200430192713.ptlo7crtwvskse7n@nabokov.fritz.box \
    --to=wolf@oriole.systems \
    --cc=gentoo-user@lists.gentoo.org \
    /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