当前位置: 首页>>技术教程>>正文


partitioning – 由于 GPT 表错误,无法格式化或删除 pendrive 中的分区

, , ,

问题描述

这是我在我的 pendrive 中格式化分区时得到的结果:

Error deleting partition /dev/sdb1: Command-line parted --script "/dev/sdb" "rm 1"' exited with non-zero exit status 1: Warning: /dev/sdb contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted — possibly by a program that doesn’t understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos partition table. Is this a GPT partition table?

Error: Both the primary and backup GPT tables are corrupt. Try making a fresh table, and using Parted’s rescue feature to recover partitions.

(udisks-error-quark, 0) 

最佳办法

我在写入已写入实时 linux 磁盘的旧驱动器时遇到了这个问题。

如果您只想擦除磁盘 /dev/sdX 的解决方案:

sudo gdisk /dev/sdX
o  

(同意删除分区)

w  

(同意写分区表)

然后你有一个完全空白的驱动器。如果您想使用它,剩下的就是创建一个分区。

注意:Gdisk是一个磁盘分区工具,一不小心就会把你的磁盘抹掉。它旨在创建、修改和擦除分区。

次佳办法

很可能您的磁盘最初包含 GUID Partition Table (GPT),,但您使用不理解 GPT 的工具创建了一个新的 Master Boot Record (MBR) 分区表。因为 GPT 比 MBR 占用更多空间,这意味着有剩余的 GPT 数据,因此 parted 变得混乱。

如果这个分析是正确的,那么最简单的解决方案是在磁盘上运行 FixParts。 FixParts 将提供删除剩余的 GPT 数据,之后您应该能够正常使用磁盘。 (您无需在 FixParts 中执行任何其他操作;只需告诉它在询问您此问题时删除 GPT 数据,然后退出。)

但是有一个警告:也有可能您有一个 GPT 磁盘,但是某些东西不小心将 MBR 分区表写入了磁盘。在这种情况下,您可能想要恢复 GPT,而不是清除它!如果是这种情况,解决方案是在磁盘上运行 gdisk。它将检测问题并询问您是否要使用 GPT 或 MBR 数据。告诉它使用 GPT 数据,通过键入 p 并将输出与您认为正确的内容进行比较来检查它是否正确,然后键入 w 以保存更改。

FixParts ( fixparts ) 和 gdisk 都是 Ubuntu 中 gdisk 包的一部分。默认情况下通常不会安装它,因此您可能必须通过键入 sudo apt-get install gdisk 来安装它。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/12808.html,未经允许,请勿转载。