我意外覆盖了我的 GPT,如何使用 gdisk 恢复它?

我意外覆盖了我的 GPT,如何使用 gdisk 恢复它?

gpt fdisk 问题

我的日立硬盘的 GPT 已损坏,它来自一台使用不到一年的 Windows 8 电脑。这几乎可以保证它处于 EFI 模式,对吗?

我正在尝试恢复日立 1 TB 驱动器上的 GPT 文件结构。我不是计算机专家,但对于新手来说,我相当熟练,可以修复大多数计算机问题并遵循明确的说明。

我当时正试图修理我儿子的电脑,所以我取出了他的硬盘并尝试重新格式化它。软件没有重新格式化外部驱动器 1,而是重新格式化了内部驱动器 0,所以我丢失了操作系统和 C 分区。

我已将驱动器取出并连接到笔记本电脑以尝试修复文件结构。

我已附上使用 GPT fdisk 的初步发现。当我选择选项 2 重建 GPT 时,它显示分区重叠。

我对这是什么意思以及下一步该做什么感到困惑。

对于您提供的任何帮助我将不胜感激。

这是我运行 gdisk 时得到的结果:

GPT fdisk (gdisk) version 0.8.10

Type device filename, or press <Enter> to exit: 1:
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! Read error 0! Misbehavior now likely!
Caution! After loading partitions, the CRC doesn't check out!
Warning! Error 0 reading partition table for CRC check!
Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: damaged

Found valid MBR and corrupt GPT. Which do you want to use? (Using the
GPT MAY permit recovery of GPT data.)
 1 - MBR
 2 - GPT
 3 - Create blank GPT

Your answer: 2
Warning! Main partition table overlaps the first partition by 34 blocks!
You will need to delete this partition or resize it in another utility.

Warning! Secondary partition table overlaps the last partition by
15650193771697010572 blocks!
You will need to delete this partition or resize it in another utility.

Command (? for help): e
b       back up GPT data to a file
c       change a partition's name
d       delete a partition
i       show detailed information on a partition
l       list known partition types
n       add a new partition
o       create a new empty GUID partition table (GPT)
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       sort partitions
t       change a partition's type code
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu

Command (? for help): l
0700 Microsoft basic data  0c01 Microsoft reserved    2700 Windows RE
3000 ONIE boot             3001 ONIE config           4100 PowerPC PReP boot
4200 Windows LDM data      4201 Windows LDM metadata  7501 IBM GPFS
7f00 ChromeOS kernel       7f01 ChromeOS root         7f02 ChromeOS reserved
8200 Linux swap            8300 Linux filesystem      8301 Linux reserved
8302 Linux /home           8400 Intel Rapid Start     8e00 Linux LVM
a500 FreeBSD disklabel     a501 FreeBSD boot          a502 FreeBSD swap
a503 FreeBSD UFS           a504 FreeBSD ZFS           a505 FreeBSD Vinum/RAID
a580 Midnight BSD data     a581 Midnight BSD boot     a582 Midnight BSD swap
a583 Midnight BSD UFS      a584 Midnight BSD ZFS      a585 Midnight BSD Vinum
a800 Apple UFS             a901 NetBSD swap           a902 NetBSD FFS
a903 NetBSD LFS            a904 NetBSD concatenated   a905 NetBSD encrypted
a906 NetBSD RAID           ab00 Apple boot            af00 Apple HFS/HFS+
af01 Apple RAID            af02 Apple RAID offline    af03 Apple label
af04 AppleTV recovery      af05 Apple Core Storage    be00 Solaris boot
bf00 Solaris root          bf01 Solaris /usr & Mac Z  bf02 Solaris swap
bf03 Solaris backup        bf04 Solaris /var          bf05 Solaris /home
bf06 Solaris alternate se  bf07 Solaris Reserved 1    bf08 Solaris Reserved 2
bf09 Solaris Reserved 3    bf0a Solaris Reserved 4    bf0b Solaris Reserved 5
c001 HP-UX data            c002 HP-UX service         ea00 Freedesktop $BOOT
eb00 Haiku BFS             ed00 Sony system partitio  ed01 Lenovo system partit
Press the <Enter> key to see more codes:
ef00 EFI System            ef01 MBR partition scheme  ef02 BIOS boot partition
fb00 VMWare VMFS           fb01 VMWare reserved       fc00 VMWare kcore crash p
fd00 Linux RAID

Command (? for help): ?
b       back up GPT data to a file
c       change a partition's name
d       delete a partition
i       show detailed information on a partition
l       list known partition types
n       add a new partition
o       create a new empty GUID partition table (GPT)
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       sort partitions
t       change a partition's type code
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu

Command (? for help):  

答案1

GPT fdisk ( gdisk) 确实可以修复许多 GPT 问题;但您显示的输出几乎毫无用处;您显示了命令列表(两次)和gdisk支持的分区类型代码列表,而这两者都不是您的系统所独有的。相反,请向我们展示pv命令揭示的有关磁盘的信息。您还应该阅读gdisk有关修复 GPT 磁盘的文档。

gdisk您所展示的输出诊断是前几行,这表明您的主 GPT 标头已损坏,但备份已损坏;但(据称未损坏的)主 GPT 数据结构显示出荒谬的重叠,表明这里也存在损坏。如果没有看到和的输出pv我无法确定,但这表明主 GPT 数据可能已损坏。可能或不可能修复此问题。加载备份数据以查看其类似情况以及检查备份数据也可能是值得的。

在最坏的情况下,可能需要使用 TestDisk,正如 gedelat 建议的那样;但您应该将其作为最后的恢复方法。

答案2

@gadelat,罗德·史密斯:在这种情况下,使用 testdisk 的“事物哈希”意味着:事情变得更加糟糕!

testdisk 在猜测某些部分时有时会带来不好的结果(尤其是在过去用作 Raid/LVM 的磁盘上)

首先尝试使用全部处于测试模式(例如 -n):

gpart, fsck.ext3 -b <alternate super block> device

ETC。

答案3

解决此类问题的最佳工具是实用程序测试磁盘。 试一试。

相关内容