Repair corrupt GPT partition table of OSX disk from Linux












0















My wife's OSX laptop won't boot. I've pulled the drive out and plugged it into a USB adapter and can see it from my Ubuntu laptop.



When I plug it and run gdisk I get the following output:



matthewh@drone:~$ sudo gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.3

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.

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): p
Disk /dev/sdc: 976773167 sectors, 465.8 GiB
Model: FA GOFlex Desk
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): F660E686-2651-434C-BC89-334BFB8D3282
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 13 sectors (6.5 KiB)

Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 975503591 465.0 GiB AF00 Untitled 1
3 975503592 976773127 619.9 MiB AB00 Recovery HD

Command (? for help): v

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 976773167 sectors, needs to be 976773168 sectors.)
The 'e' option on the experts' menu may fix this problem.

Identified 2 problems!

Command (? for help): q


What's the recommended course of action at this point?



And I should point out that the drive is a Samsung 840 Evo. I think I need to upgrade the firmware as I hear there was a bug. Could the corruption be related?










share|improve this question

























  • As it says the e option in that advanced x option on first menu may work. Note x option: Enter the experts' menu. Using this option provides access to features you can use to get into even more trouble than the main menu allows. ? So good backups are required. rodsbooks.com/gdisk/gdisk.html Also: askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/…

    – oldfred
    Feb 5 at 23:18











  • Using gdisk I wrote the partition table and ran fsck.hfs to repair it. I was then able to mount the fs and get the data off. The disk wasn't recognised by the laptop, but neither was the old HDD that was the original drive in the laptop and was previously working. Cleared the PROM etc but seems that this laptop is toast. At least I have all the data. Thanks for the suggestions.

    – Matt H
    Feb 6 at 0:41
















0















My wife's OSX laptop won't boot. I've pulled the drive out and plugged it into a USB adapter and can see it from my Ubuntu laptop.



When I plug it and run gdisk I get the following output:



matthewh@drone:~$ sudo gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.3

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.

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): p
Disk /dev/sdc: 976773167 sectors, 465.8 GiB
Model: FA GOFlex Desk
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): F660E686-2651-434C-BC89-334BFB8D3282
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 13 sectors (6.5 KiB)

Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 975503591 465.0 GiB AF00 Untitled 1
3 975503592 976773127 619.9 MiB AB00 Recovery HD

Command (? for help): v

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 976773167 sectors, needs to be 976773168 sectors.)
The 'e' option on the experts' menu may fix this problem.

Identified 2 problems!

Command (? for help): q


What's the recommended course of action at this point?



And I should point out that the drive is a Samsung 840 Evo. I think I need to upgrade the firmware as I hear there was a bug. Could the corruption be related?










share|improve this question

























  • As it says the e option in that advanced x option on first menu may work. Note x option: Enter the experts' menu. Using this option provides access to features you can use to get into even more trouble than the main menu allows. ? So good backups are required. rodsbooks.com/gdisk/gdisk.html Also: askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/…

    – oldfred
    Feb 5 at 23:18











  • Using gdisk I wrote the partition table and ran fsck.hfs to repair it. I was then able to mount the fs and get the data off. The disk wasn't recognised by the laptop, but neither was the old HDD that was the original drive in the laptop and was previously working. Cleared the PROM etc but seems that this laptop is toast. At least I have all the data. Thanks for the suggestions.

    – Matt H
    Feb 6 at 0:41














0












0








0








My wife's OSX laptop won't boot. I've pulled the drive out and plugged it into a USB adapter and can see it from my Ubuntu laptop.



When I plug it and run gdisk I get the following output:



matthewh@drone:~$ sudo gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.3

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.

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): p
Disk /dev/sdc: 976773167 sectors, 465.8 GiB
Model: FA GOFlex Desk
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): F660E686-2651-434C-BC89-334BFB8D3282
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 13 sectors (6.5 KiB)

Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 975503591 465.0 GiB AF00 Untitled 1
3 975503592 976773127 619.9 MiB AB00 Recovery HD

Command (? for help): v

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 976773167 sectors, needs to be 976773168 sectors.)
The 'e' option on the experts' menu may fix this problem.

Identified 2 problems!

Command (? for help): q


What's the recommended course of action at this point?



And I should point out that the drive is a Samsung 840 Evo. I think I need to upgrade the firmware as I hear there was a bug. Could the corruption be related?










share|improve this question
















My wife's OSX laptop won't boot. I've pulled the drive out and plugged it into a USB adapter and can see it from my Ubuntu laptop.



When I plug it and run gdisk I get the following output:



matthewh@drone:~$ sudo gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.3

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.

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): p
Disk /dev/sdc: 976773167 sectors, 465.8 GiB
Model: FA GOFlex Desk
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): F660E686-2651-434C-BC89-334BFB8D3282
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 13 sectors (6.5 KiB)

Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 975503591 465.0 GiB AF00 Untitled 1
3 975503592 976773127 619.9 MiB AB00 Recovery HD

Command (? for help): v

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 976773167 sectors, needs to be 976773168 sectors.)
The 'e' option on the experts' menu may fix this problem.

Identified 2 problems!

Command (? for help): q


What's the recommended course of action at this point?



And I should point out that the drive is a Samsung 840 Evo. I think I need to upgrade the firmware as I hear there was a bug. Could the corruption be related?







partitioning macosx gpt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 5 at 22:06







Matt H

















asked Feb 5 at 22:01









Matt HMatt H

1,51952033




1,51952033













  • As it says the e option in that advanced x option on first menu may work. Note x option: Enter the experts' menu. Using this option provides access to features you can use to get into even more trouble than the main menu allows. ? So good backups are required. rodsbooks.com/gdisk/gdisk.html Also: askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/…

    – oldfred
    Feb 5 at 23:18











  • Using gdisk I wrote the partition table and ran fsck.hfs to repair it. I was then able to mount the fs and get the data off. The disk wasn't recognised by the laptop, but neither was the old HDD that was the original drive in the laptop and was previously working. Cleared the PROM etc but seems that this laptop is toast. At least I have all the data. Thanks for the suggestions.

    – Matt H
    Feb 6 at 0:41



















  • As it says the e option in that advanced x option on first menu may work. Note x option: Enter the experts' menu. Using this option provides access to features you can use to get into even more trouble than the main menu allows. ? So good backups are required. rodsbooks.com/gdisk/gdisk.html Also: askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/…

    – oldfred
    Feb 5 at 23:18











  • Using gdisk I wrote the partition table and ran fsck.hfs to repair it. I was then able to mount the fs and get the data off. The disk wasn't recognised by the laptop, but neither was the old HDD that was the original drive in the laptop and was previously working. Cleared the PROM etc but seems that this laptop is toast. At least I have all the data. Thanks for the suggestions.

    – Matt H
    Feb 6 at 0:41

















As it says the e option in that advanced x option on first menu may work. Note x option: Enter the experts' menu. Using this option provides access to features you can use to get into even more trouble than the main menu allows. ? So good backups are required. rodsbooks.com/gdisk/gdisk.html Also: askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/…

– oldfred
Feb 5 at 23:18





As it says the e option in that advanced x option on first menu may work. Note x option: Enter the experts' menu. Using this option provides access to features you can use to get into even more trouble than the main menu allows. ? So good backups are required. rodsbooks.com/gdisk/gdisk.html Also: askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/…

– oldfred
Feb 5 at 23:18













Using gdisk I wrote the partition table and ran fsck.hfs to repair it. I was then able to mount the fs and get the data off. The disk wasn't recognised by the laptop, but neither was the old HDD that was the original drive in the laptop and was previously working. Cleared the PROM etc but seems that this laptop is toast. At least I have all the data. Thanks for the suggestions.

– Matt H
Feb 6 at 0:41





Using gdisk I wrote the partition table and ran fsck.hfs to repair it. I was then able to mount the fs and get the data off. The disk wasn't recognised by the laptop, but neither was the old HDD that was the original drive in the laptop and was previously working. Cleared the PROM etc but seems that this laptop is toast. At least I have all the data. Thanks for the suggestions.

– Matt H
Feb 6 at 0:41










1 Answer
1






active

oldest

votes


















0














The first step is attempt to make a backup of your partition. Plug an external drive and try to mount your system disk. You can do it from Ubuntu user interface, or command line:



sudo mount /dev/sdc2 /mnt
cp -a /mnt/ /media/live/usb (you might adapt the folder path with mounted location).


Then you can try to use testdisk utility which is a useful partition schema recovery. Basically, how can you use it from an Ubuntu Live USB.



apt install testdisk


Then, run on your hard drive



testdisk /dev/sdc


Here the steps :



* Select your hard drive then press Enter to "Proceed"
* Choose EFI GPT (seems you are using EFI)
* Choose Analyse
* Eventually choose Backup to make a backup of your current partition schema.
* Quick Search
* If the tool found partition, you can try to Write (be very careful of what you do at this stage as you might loose all partitions and data included - again be sure you have a backup).


Of course you can try upgrading your hard drive firmware, but not sure it's the issue. Looks like your partition sector is not rounded properly. I don't know where your OSX boot stops, but if any doubts, you should probably re-install your operating system by re-doing a proper partition first.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115944%2frepair-corrupt-gpt-partition-table-of-osx-disk-from-linux%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The first step is attempt to make a backup of your partition. Plug an external drive and try to mount your system disk. You can do it from Ubuntu user interface, or command line:



    sudo mount /dev/sdc2 /mnt
    cp -a /mnt/ /media/live/usb (you might adapt the folder path with mounted location).


    Then you can try to use testdisk utility which is a useful partition schema recovery. Basically, how can you use it from an Ubuntu Live USB.



    apt install testdisk


    Then, run on your hard drive



    testdisk /dev/sdc


    Here the steps :



    * Select your hard drive then press Enter to "Proceed"
    * Choose EFI GPT (seems you are using EFI)
    * Choose Analyse
    * Eventually choose Backup to make a backup of your current partition schema.
    * Quick Search
    * If the tool found partition, you can try to Write (be very careful of what you do at this stage as you might loose all partitions and data included - again be sure you have a backup).


    Of course you can try upgrading your hard drive firmware, but not sure it's the issue. Looks like your partition sector is not rounded properly. I don't know where your OSX boot stops, but if any doubts, you should probably re-install your operating system by re-doing a proper partition first.






    share|improve this answer




























      0














      The first step is attempt to make a backup of your partition. Plug an external drive and try to mount your system disk. You can do it from Ubuntu user interface, or command line:



      sudo mount /dev/sdc2 /mnt
      cp -a /mnt/ /media/live/usb (you might adapt the folder path with mounted location).


      Then you can try to use testdisk utility which is a useful partition schema recovery. Basically, how can you use it from an Ubuntu Live USB.



      apt install testdisk


      Then, run on your hard drive



      testdisk /dev/sdc


      Here the steps :



      * Select your hard drive then press Enter to "Proceed"
      * Choose EFI GPT (seems you are using EFI)
      * Choose Analyse
      * Eventually choose Backup to make a backup of your current partition schema.
      * Quick Search
      * If the tool found partition, you can try to Write (be very careful of what you do at this stage as you might loose all partitions and data included - again be sure you have a backup).


      Of course you can try upgrading your hard drive firmware, but not sure it's the issue. Looks like your partition sector is not rounded properly. I don't know where your OSX boot stops, but if any doubts, you should probably re-install your operating system by re-doing a proper partition first.






      share|improve this answer


























        0












        0








        0







        The first step is attempt to make a backup of your partition. Plug an external drive and try to mount your system disk. You can do it from Ubuntu user interface, or command line:



        sudo mount /dev/sdc2 /mnt
        cp -a /mnt/ /media/live/usb (you might adapt the folder path with mounted location).


        Then you can try to use testdisk utility which is a useful partition schema recovery. Basically, how can you use it from an Ubuntu Live USB.



        apt install testdisk


        Then, run on your hard drive



        testdisk /dev/sdc


        Here the steps :



        * Select your hard drive then press Enter to "Proceed"
        * Choose EFI GPT (seems you are using EFI)
        * Choose Analyse
        * Eventually choose Backup to make a backup of your current partition schema.
        * Quick Search
        * If the tool found partition, you can try to Write (be very careful of what you do at this stage as you might loose all partitions and data included - again be sure you have a backup).


        Of course you can try upgrading your hard drive firmware, but not sure it's the issue. Looks like your partition sector is not rounded properly. I don't know where your OSX boot stops, but if any doubts, you should probably re-install your operating system by re-doing a proper partition first.






        share|improve this answer













        The first step is attempt to make a backup of your partition. Plug an external drive and try to mount your system disk. You can do it from Ubuntu user interface, or command line:



        sudo mount /dev/sdc2 /mnt
        cp -a /mnt/ /media/live/usb (you might adapt the folder path with mounted location).


        Then you can try to use testdisk utility which is a useful partition schema recovery. Basically, how can you use it from an Ubuntu Live USB.



        apt install testdisk


        Then, run on your hard drive



        testdisk /dev/sdc


        Here the steps :



        * Select your hard drive then press Enter to "Proceed"
        * Choose EFI GPT (seems you are using EFI)
        * Choose Analyse
        * Eventually choose Backup to make a backup of your current partition schema.
        * Quick Search
        * If the tool found partition, you can try to Write (be very careful of what you do at this stage as you might loose all partitions and data included - again be sure you have a backup).


        Of course you can try upgrading your hard drive firmware, but not sure it's the issue. Looks like your partition sector is not rounded properly. I don't know where your OSX boot stops, but if any doubts, you should probably re-install your operating system by re-doing a proper partition first.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 5 at 23:05









        olivierb2olivierb2

        1,96989




        1,96989






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115944%2frepair-corrupt-gpt-partition-table-of-osx-disk-from-linux%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

             ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕