Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Recover Lost or Corrupted GPT Partition

  1. #11
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Recover Lost or Corrupted GPT Partition

    Keep us updated, it may help someone searching in the future or we can pass along the info.

    I would also try fixes, just to see if they work. Then if that happens again we have a quicker(?) way to repair.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  2. #12
    Join Date
    Aug 2010
    Beans
    10

    Re: Recover Lost or Corrupted GPT Partition

    Sure thing, I'll try the fixes I've proposed, once the data is safe (about an hour away, that's USB2 for ya). I'm interested in the outcome myself. Though I'd venture that resizing the damaged partition in situ, even if it works this time, would be more dangerous than what we did here.

    If I try the resize and it doesn't work do I still mark as solved? since I got the data off, I'm guessing yes. But then if a tree ...

  3. #13
    Join Date
    Aug 2010
    Beans
    10

    Re: Recover Lost or Corrupted GPT Partition

    OK, I'm going to explore this a bit further, for prosperity sake.

    a quick recap of where we stand

    orig-drive (320GB Hitachi): I formatted with ubuntu's disk utility (on 11.10) using a guid partition table, and created one big ext4 partition, moved a bunch of mixed type data (295GB) to it. shutdown, removed drive, walked to 2nd computer, installed, booted, discovered drive was listed as free space. doh! gdisk returned a bunch of errors, but it seemed to me (I'm no expert) that the big problem, and why the computer wouldn't mount the partition was that it ended on a higher sector than possible for the number of sectors on the drive. In addition the backup gpt header was also situated after the last possible sector. Trying to rewrite the backup header (using gdisk) didn't work as the disk was not big enough.

    backup-drive (320 GB): is a second drive I formatted with ubuntu's disk utility (on 11.10) using a guid partition table, and created one big ext4 partition. Used this to compare partition table structure with original drive.

    Used dd_rescue to copy orig-drive to backup-drive, which despite having the same size on the label, reported a few more sectors. Following this I was able to mount resulting drive and get data off.

    Now I'm going to see what happens when I try a couple of other options with the drives.

    Firstly, using gdisk on the backup-drive, complains that the disk guid in the main header doesn't match the disk guid in the backup header. Comparing the information in both shows the only difference is the disk guid, so I've opted to copy the backup header over the top of the main header. My thinking is as follows: I don't want two disks with the same guid, the rest of the information is the same, so no harm done (I also made a backup of the partition table to a file before hand using gdisk). This has worked. gdisk is no longer complaining. drive mounts, data accessible.

    Just noticed you can change the disk guid in the extra (x) expert menu of gdisk, could be useful for dealing with this.

    Code:
    root@zeus:/home/dan# gdisk /dev/sdd
    GPT fdisk (gdisk) version 0.8.4
    
    Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
    on the recovery & transformation menu to examine the two tables.
    
    Warning! One or more CRCs don't match. You should repair the disk!
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: damaged
    
    ****************************************************************************
    Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
    verification and recovery are STRONGLY recommended.
    ****************************************************************************
    
    Command (? for help): v
    
    Caution: The CRC for the backup partition table is invalid. This table may
    be corrupt. This program will automatically create a new backup partition
    table when you save your partitions.
    
    Problem: main header's disk GUID (4FF348B9-D041-49A6-AD98-18C15F055F2D) doesn't
    match the backup GPT header's disk GUID (58F7115C-D8E0-4D86-B93A-1421EE9F14B8)
    You should use the 'b' or 'd' option on the recovery & transformation menu to
    select one or the other header.
    
    Caution: Partition 1 doesn't begin on a 8-sector boundary. This may
    result in degraded performance on some modern (2009 and later) hard disks.
    
    Consult http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/
    for information on disk alignment.
    
    Identified 2 problems!
    
    Command (? for help): r
    
    Recovery/transformation command (? for help): p
    Disk /dev/sdd: 625142448 sectors, 298.1 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 4FF348B9-D041-49A6-AD98-18C15F055F2D
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 625142414
    Partitions will be aligned on 8-sector boundaries
    Total free space is 0 sectors (0 bytes)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              34       625142414   298.1 GiB   0700  
    
    Recovery/transformation command (? for help): i
    Using 1
    Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
    Partition unique GUID: 9E79F802-02B9-4097-8CD2-F9FFE96136BD
    First sector: 34 (at 17.0 KiB)
    Last sector: 625142414 (at 298.1 GiB)
    Partition size: 625142381 sectors (298.1 GiB)
    Attribute flags: 0000000000000000
    Partition name: ''
    
    Recovery/transformation command (? for help): m
    
    Command (? for help): b
    Enter backup filename to save: gptpart-rd.gpt
    The operation has completed successfully.
    
    Command (? for help): r
    
    Recovery/transformation command (? for help): i
    Using 1
    Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
    Partition unique GUID: 9E79F802-02B9-4097-8CD2-F9FFE96136BD
    First sector: 34 (at 17.0 KiB)
    Last sector: 625142414 (at 298.1 GiB)
    Partition size: 625142381 sectors (298.1 GiB)
    Attribute flags: 0000000000000000
    Partition name: ''
    
    Recovery/transformation command (? for help): p   
    Disk /dev/sdd: 625142448 sectors, 298.1 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 4FF348B9-D041-49A6-AD98-18C15F055F2D
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 625142414
    Partitions will be aligned on 8-sector boundaries
    Total free space is 0 sectors (0 bytes)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              34       625142414   298.1 GiB   0700  
    
    Recovery/transformation command (? for help): b
    
    Recovery/transformation command (? for help): i
    Using 1
    Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
    Partition unique GUID: 9E79F802-02B9-4097-8CD2-F9FFE96136BD
    First sector: 34 (at 17.0 KiB)
    Last sector: 625142414 (at 298.1 GiB)
    Partition size: 625142381 sectors (298.1 GiB)
    Attribute flags: 0000000000000000
    Partition name: ''
    
    Recovery/transformation command (? for help): p
    Disk /dev/sdd: 625142448 sectors, 298.1 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 58F7115C-D8E0-4D86-B93A-1421EE9F14B8
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 625142414
    Partitions will be aligned on 8-sector boundaries
    Total free space is 0 sectors (0 bytes)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              34       625142414   298.1 GiB   0700  
    
    Recovery/transformation command (? for help): b
    
    Recovery/transformation command (? for help): v
    
    Caution: The CRC for the backup partition table is invalid. This table may
    be corrupt. This program will automatically create a new backup partition
    table when you save your partitions.
    
    Caution: Partition 1 doesn't begin on a 8-sector boundary. This may
    result in degraded performance on some modern (2009 and later) hard disks.
    
    Consult http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/
    for information on disk alignment.
    
    Identified 1 problems!
    
    Recovery/transformation command (? for help): w
    
    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!
    
    Do you want to proceed? (Y/N): Y
    OK; writing new GUID partition table (GPT) to /dev/sdd.
    The operation has completed successfully.
    root@zeus:/home/dan# gdisk /dev/sdd
    GPT fdisk (gdisk) version 0.8.4
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    
    Command (? for help): p
    Disk /dev/sdd: 625142448 sectors, 298.1 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 58F7115C-D8E0-4D86-B93A-1421EE9F14B8
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 625142414
    Partitions will be aligned on 8-sector boundaries
    Total free space is 0 sectors (0 bytes)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              34       625142414   298.1 GiB   0700  
    
    Command (? for help): i
    Using 1
    Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
    Partition unique GUID: 9E79F802-02B9-4097-8CD2-F9FFE96136BD
    First sector: 34 (at 17.0 KiB)
    Last sector: 625142414 (at 298.1 GiB)
    Partition size: 625142381 sectors (298.1 GiB)
    Attribute flags: 0000000000000000
    Partition name: ''
    
    Command (? for help): q
    root@zeus:/home/dan#
    The second thing I wanted to try was to fix the original disk, in place, possibly by resizing the partition so it fit the size the disk is now reporting. I had said there is a resize facility in the gdisk menu but actually its to resize the partition table, not the partition. And since parted crashes on inspecting this disk, I guess we are done here. I would have liked a solution to recovering the original disk without needing the second same sized disk but, hey, I got my data off.

    Feel free to chime in, and correct any noob mistakes I've made.

  4. #14
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Recover Lost or Corrupted GPT Partition

    The only thing I found that might work, but I only suggest it if you have given up on everything else as I really do not know.

    gdisk also has sgdisk
    http://www.rodsbooks.com/gdisk/sgdisk.html

    -d, --delete=partnum Delete a partition. This action deletes the entry from the partition table but does not disturb the data within the sectors originally allocated to the partition on the disk. If a corresponding hybrid MBR partition exists, gdisk deletes it, as well, and expands any adjacent 0xEE (EFI GPT) MBR protective partition to fill the new free space.

    then create a new partition with the correct size?


    -n, --new=partnum:start:end Create a new partition. You enter a partition number, starting sector, and an ending sector. Both start and end sectors can be specified in absolute terms as sector numbers or as positions measured in kibibytes (K), mebibytes (M), gibibytes (G), tebibytes (T), or pebibytes (P); for instance, 40M specifies a position 40MiB from the start of the disk. You can specify locations relative to the start or end of the specified default range by preceding the number by a '+' or '-' symbol, as in +2G to specify a point 2GiB after the default start sector, or -200M to specify a point 200MiB before the last available sector. A start or end value of 0 specifies the default value, which is the start of the largest available block for the start sector and the end of the same block for the end sector. A partnum value of 0 causes the program to use the first available partition number.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  5. #15
    Join Date
    Apr 2010
    Beans
    31

    Re: Recover Lost or Corrupted GPT Partition

    I have the same or similar problem. What I did was clone a 750Gb windows drive to a smaller disk by first shrinking the huge data partition and moving all partitions as close to the start of the disks as possible using gparted to make sure the partitions end before the size of the small disk, then copying the big disk to the small disk using dd.

    After plugging the small disk in to my linux box, then gdisk shows the exact same warning/error messages. I bet, for some reason, you can't simply dd gpt disks when the disk sizes vary...

    Attempting to boot windows from the smaller cloned drive doesn't work.

    If I find a solution I'll post here.

  6. #16
    Join Date
    Apr 2010
    Beans
    31

    Re: Recover Lost or Corrupted GPT Partition

    For me, the fix was easy. I went into gdisk's expert mode, then I ran the 'e' command to relocate the backup GPT table to the end of the disk (an obvious thing to do knowing how GPT works now, and that the disk sizes were of different size). Then, I used 'w' to write changes and exit. Problem fixed!

    More details here: https://bbs.archlinux.org/viewtopic.php?pid=1201526

  7. #17
    Join Date
    Jul 2008
    Beans
    4

    Re: Recover Lost or Corrupted GPT Partition

    I just updated from 10.04 to 10.04 and am now unable to mount my secondary (storage only) drive.

    Here is what I get when I run gdisk -l /dev/sda

    Code:
     
    GPT fdisk (gdisk) version 0.8.1
    
    Warning! Disk size is smaller than the main header indicates! Loading
    secondary header from the last sector of the disk! You should use 'v' to
    verify disk integrity, and perhaps options on the experts' menu to repair
    the disk.
    Caution: invalid backup GPT header, but valid main header; regenerating
    backup header from main header.
    
    Warning! One or more CRCs don't match. You should repair the disk!
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: damaged
    
    ****************************************************************************
    Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
    verification and recovery are STRONGLY recommended.
    ****************************************************************************
    Disk /dev/sda: 1953523055 sectors, 931.5 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): B0A76717-E1A2-4FA0-A5B6-D37CDE96D617
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 1953525134
    Partitions will be aligned on 8-sector boundaries
    Total free space is 5070 sectors (2.5 MiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       2              34      1953520064   931.5 GiB   0700
    Any suggestions on this would be helpful.

  8. #18
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Recover Lost or Corrupted GPT Partition

    Have you tried the gdisk experts mode and the commands posted above?
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  9. #19
    Join Date
    Jul 2008
    Beans
    4

    Re: Recover Lost or Corrupted GPT Partition

    We'll yes and no. I have run the gdisk application and got to the experts menu, just not sure which commands to run. I (think I) Backed up the old partition data.

    I haven't looked at using the dd tools yet as I don't have another drive big enough to clone this one to (1tb).

    Should I start with

    Code:
    gdisk /dev/sta
    r
    x
    e
    w
    or

    Code:
    gdisk /dev/sda
    r
    c
    w
    ?

  10. #20
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Recover Lost or Corrupted GPT Partition

    I have several gpt drives, but never have had to run the experts commands to repair them.

    If you have good backups, you should be ok.

    If any command does not seem to give good results do not issue the w so it does not write the changes.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •