3

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?

hookenz
  • 2,579
  • 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. http://www.rodsbooks.com/gdisk/gdisk.html Also: https://askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/386802#386802

    – oldfred Feb 05 '19 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. – hookenz Feb 06 '19 at 00:41
  • 1
    Your phyical disk has 976773167 sectors. You've lied to your partition table, saying the disk has 976773168 sectors. Subtract 1 from 976773168, fix your partition table, and get right with the world. – waltinator Aug 01 '23 at 00:37
  • That might have been a useful answer 3 years ago. As it turned out I put the old drive back in and that didn't boot either. There was something physically wrong with the hardware. – hookenz Aug 02 '23 at 20:56

1 Answers1

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.

ob2
  • 3,553