GPT 磁盘分区恢复

GPT 磁盘分区恢复

我无法让我的分区在其中一个驱动器上正确显示。

设置:

  • Linux 3.10.10-1-ARCH
  • 磁盘为 2TB,具有带两个分区的 GPT。
  • 这两个分区每个大约有 700GB,因此绝对有足够的空间容纳所有内容。
  • 磁盘上的数据有完整的备份,但需要很长时间才能重建(异地备份),所以如果可能的话,我真的很想解决这个问题。
  • 我在 livecd 上的 gparted 中创建了分区,然后从旧磁盘上 dd 了数据。
  • 两个分区都是 ext4,但这并不重要。

我运行的问题:

sudo gdisk /dev/sdb

我得到:

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

因此我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: 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 1953569134 sectors, needs to be 3907029168 sectors.)
The 'e' option on the experts' menu may fix this problem.

Problem: GPT claims the disk is larger than it is! (Claimed last usable
sector is 3907029134, but backup header is at
3907029167 and disk size is 1953569134 sectors.
The 'e' option on the experts' menu will probably fix this problem

Problem: partition 2 is too big for the disk.

Identified 5 problems!

e再次运行后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: partition 2 is too big for the disk.

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

Identified 3 problems!

我现在可以使用以下命令查看正确的分区p

Disk /dev/sdb: 1953569134 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): D690A9B2-EA00-4D2E-9E18-0D4545A8683A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953569100
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      1953515519   931.5 GiB   0700  
   2      1953515520      3907028991   931.5 GiB   0700 

我陷入困境,如能得到任何帮助我将非常感激。

答案1

首先,你声称:

  • 磁盘为 2TB,具有带两个分区的 GPT。

不幸的是,gdisk不同意你的观点:

Disk /dev/sdb: 1953569134 sectors, 931.5 GiB

我建议您仔细检查磁盘的声称大小;它通常印在磁盘主体上的标签上。如果您真的有一个 931.5GiB (1TiB) 的磁盘,那么您不可能gdisk在上面安装两个 ~700GB(声称 931.5GiB)的分区。因此,如果gdisk有正确的数据,您必须获得更大的磁盘或(如果您在原始文件系统中使用的实际空间不超过 1TB)将原始文件级备份到 1TB 目标磁盘。

如果你的磁盘被标记为 2TB 型号,那么它要么是标记错误,要么是你遇到了问题主机保护区 (HPA)功能。此功能可让您“隐藏”一定数量的磁盘空间以用于各种隐蔽目的。不过,根据我看过的在线帖子,它有时会设置错误并导致像您这样的问题。您可以使用选项查看和更改此功能-Nhdparm输入sudo hdparm -N /dev/sdb应该会显示驱动器的当前 HPA 设置。如果此功能处于活动状态,请输入man hdparm并阅读选项部分-N。基本上,您需要通过传递磁盘上的真实扇区数-N来重置它并使用其全部容量。

相关内容