How to fix a corrupted(too big) GPT?

5,162

First, a minor point: The problem messages you quoted come from GPT fdisk (gdisk, sgdisk, or cgdisk), not from GParted. I just want to clarify that in case somebody gets confused over it in the future.

The Host Protected Area (HPA) is a mess, since some OSes seem to ignore it, which can result in the sort of error you're seeing. If you're using an HPA, consider disabling that feature. If this is the source of the problem, you'll almost certainly need to do this in order to recover your data, since the messages you quoted clearly indicate that your disk has a partition that's greatly in excess of the available space. This could happen if you partitioned the disk with an HPA-ignorant OS or if you partitioned before setting an HPA and if you subsequently moved to an HPA-honoring OS or set an HPA.

Since your tags indicate you're using Linux, you can check for the disk's HPA status with hdparm:

$ sudo hdparm -N /dev/sda

/dev/sda:
 max sectors   = 976773168/976773168, HPA is disabled

This shows a disk with HPA disabled; it would show something else with HPA enabled.

It's also possible that your SSD is malfunctioning. If this is the case, you'll have to back up as much of the data as you can and send the disk back for repair or replacement.

Share:
5,162

Related videos on Youtube

The_g U r U
Author by

The_g U r U

Hello there! My name's Jordan Earls, but most people online know me as "earlz". I'm the lead developer and a co-founder of the Qtum project which brings the Ethereum Virtual Machine (ie, the thing that makes Solidity contracts function) to a UTXO based blockchain similar to Bitcoin. I've been programming since I was 13 and am completely self-taught. Low-level code like assembly and pointer arithmetic is the fun stuff for me. I also make music when I have time even though it's usually awful. Most of my personal projects are open source and BSD licensed. The majority of them are at bitbucket with the rest of them being listed on github Also, you can follow me on the twitters @earlzdotnet

Updated on September 18, 2022

Comments

  • The_g U r U
    The_g U r U over 1 year

    So, I got a new SSD. I decided to use GPT instead of MBR on it, so I'm a bit lost. It ended up getting corrupted. I'm not for sure if the GPT just didn't take the host protected area into account, or if my SSD actually lost some data. So, I'm trying to just get it to mount right now. The problem is I get this error from gparted that the partition is too big:

    Problem: The secondary header's self-pointer indicates that it doesn't reside at the end of the disk. If you've added a disk to a RAID array, use the 'e' option on the experts' menu to adjust the secondary header's and partition table's locations.

    Problem: Disk is too small to hold all the data! (Disk size is 390717734 sectors, needs to be 488397168 sectors.) The 'e' option on the experts' menu may fix this problem.

    Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 488397134, but backup header is at 488397167 and disk size is 390717734 sectors. The 'e' option on the experts' menu will probably fix this problem

    Problem: partition 1 is too big for the disk.

    Identified 4 problems!

    (there was also a CRC error, but I restored the GPT from the backup structures and that went away)

    I've tried doing the e option in experts mode, but only the CRC error went away, not these problems.

    How can I fix this to attempt to repair the FS and get it to mount? I have backups, but it'd mean I'd lose some work since I last did a backup.

    Also, does this sound like data corruption or like something that could spawn from it not taking the HPA into account?

  • The_g U r U
    The_g U r U about 11 years
    That's the odd thing. I enabled HPA manually with hdparm before formatting and partitioning. I also ensured that the usable sectors was what I expected before hand.. then one reboot later and now the size seems to have changed. I can't remember what the size was, so I don't know for sure if it changed or anything
  • ile
    ile almost 5 years
    Thank you Rod Smith (@rod-smith), I had similar error messages from gdisk and disabling HPA worked for me. Maybe gdisk could suggest HPA being the problem in cases like this?