备份 GPT 表已损坏。正在运行 fdisk

备份 GPT 表已损坏。正在运行 fdisk

我使用 fdisk -l 检查了我的磁盘,发现其中有一个The backup GPT table is corrupt, but the primary appears OK, so that will be used.

我不确定它指的是哪个磁盘,但我怀疑它可能是我的 16GB 的可启动 USB。

我该怎么办?

这是终端输出。


We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for amnesia: 
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier:

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sda1  *      2048    206847    204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2       206848 522741759 522534912 249.2G  7 HPFS/NTFS/exFAT


The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sdb: 14.9 GiB, 16008609792 bytes, 31266816 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 

Device        Start      End  Sectors  Size Type
/dev/sdb1      2048 16779263 16777216    8G EFI System
/dev/sdb2  16783360 31266782 14483423  6.9G Linux filesystem




Disk /dev/loop0: 1.1 GiB, 1181437952 bytes, 2307496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 75.7 MiB, 79384576 bytes, 155048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/TailsData_unlocked: 6.9 GiB, 7413415424 bytes, 14479327 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 1.8 TiB, 2000365289472 bytes, 3906963456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 

Device          Start        End    Sectors   Size Type
/dev/sdc1        2048 1536002047 1536000000 732.4G Microsoft basic data
/dev/sdc2  1536002048 3072002047 1536000000 732.4G Apple HFS/HFS+
/dev/sdc3  3072002048 3906758655  834756608   398G Linux filesystem
amnesia@amnesia:~$```

答案1

好吧,如果你运行了fdisk -l——也就是说,没有指定设备——它显然会扫描它找到的所有设备。

当它扫描时/dev/sda,它发现了有关它的两个事实(除其他外):

  • 它使用所谓 GPT 格式的分区表((较旧的)x86 硬件上的另一种替代格式是所谓的 MBR)。
  • 它发现 GPT 分区表的备份副本已损坏,但主副本正常。

它会继续读取主副本并输出其中的数据。然后它还会对其他存储设备执行此操作。

我该怎么办?

这个问题不太容易回答。

一个显而易见且轻率的反应就是恢复备份副本,然后就完事了。就是这样

但事实上,它已损坏可能表明驱动器的硬件出现故障。也可能不是。

我会执行以下操作。

  1. tar使用常规文件副本或最适合您的方法将该驱动器中的所有数据备份到某处。

  2. 备份其分区数据:

    # sfdisk --dump /dev/sda > /path/to/sda.part
    
  3. 在设备上运行硬件压力测试;老手badblocks可能会这样做:

    # badblocks -s -w -p N /dev/sda
    

    (您也可以添加一些内容-v以使其更加健谈,尽管-s通常这就足够了。)

    请注意-w——“破坏性的读/写测试”,——并将-p N传递次数设置为N。选择该数字至少为,我不知道,4。

    让我重复一遍:在此模式下运行测试-w将破坏驱动器上的所有数据。但作为回报,此模式会最大限度地对驱动器施加压力。

  4. 完成后badblocks(可能需要一段时间 - 尤其是对于较大的情况N),查看其报告的内容。

    如果报告故障,则应视为您的驱动器已损坏并被扔掉,或者如果仍在保修范围内则进行更换。

  5. 如果badblocks说驱动器没有问题,请smartctlsmartmontools包中运行:

    # smartctl --all /dev/sda
    

    然后密切关注一些事情:

    • 错误日志;在真正适合的驱动器中它必须是空的。

    • 处理坏块的 SMART 变量:Reallocated_Event_Count,, 。这些Current_Pending_Sector变量Offline_Uncorrectable的含义依次为:重新映射的扇区(块)数量、当前被视为坏块且正在由驱动器固件测试的块数量、驱动器固件发现的坏块数量,但由于可用于重新映射的可用扇区表已被先前的坏块耗尽,因此无法重新映射这些扇区。

    (总体上了解一下 SMART 可能是个好主意。)

    如果您发现读数周围有任何异常,最好不要依赖驱动器。

  6. 毕竟,如果一切顺利,您可以有一定程度的信心声称备份 GPT 的损坏是由于某些未知因素(外星人、光明会等)造成的,然后继续恢复驱动器:

    1. 找回分区表:

      # sfdisk /dev/sda < /path/to/sda.part

    2. 确保操作系统可以看到新的分区:

      # blockdev --rereadpt /dev/sda

    3. 使用您喜欢的任何工具在恢复的分区上重新创建文件系统(看起来两个分区都是 exFAT)。

    4. 恢復文件。

相关内容