从 Linux 修复 OSX 磁盘损坏的 GPT 分区表

从 Linux 修复 OSX 磁盘损坏的 GPT 分区表

我妻子的 OSX 笔记本电脑无法启动。我拔出驱动器并将其插入 USB 适配器,然后可以从我的 Ubuntu 笔记本电脑上看到它。

当我插入它并运行 gdisk 时,我得到以下输出:

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

此时建议采取什么行动?

我应该指出的是,该驱动器是三星 840 Evo。我认为我需要升级固件,因为我听说有一个错误。损坏是否与此有关?

答案1

第一步是尝试备份您的分区。插入外部驱动器并尝试安装您的系统磁盘。您可以从 Ubuntu 用户界面或命令行执行此操作:

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

然后您可以尝试使用testdisk实用程序,这是一个有用的分区架构恢复。基本上,您可以从 Ubuntu Live USB 使用它。

apt install testdisk

然后在你的硬盘上运行

testdisk /dev/sdc

步骤如下:

* 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).

当然,您可以尝试升级硬盘固件,但不确定这是否是问题所在。看起来您的分区扇区没有正确舍入。我不知道您的 OSX 启动在哪里停止,但如果有任何疑问,您可能应该先重新进行正确的分区,然后重新安装操作系统。

相关内容