AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1442713
Accepted
me0076
me0076
Asked: 2019-05-30 12:14:36 +0800 CST2019-05-30 12:14:36 +0800 CST 2019-05-30 12:14:36 +0800 CST

如何使用混合 MBR 修复损坏的 GPT?

  • 772

我的 SD 卡有一些问题,但我无法修复它们。
这是磁盘在 GNOME 磁盘中的样子: Ubuntu 磁盘

当我运行时gdisk /dev/sdb,它给出以下输出:

sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.3

Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
MBR: hybrid
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.

我不确定应该使用哪个分区表,但我使用了 GPT(创建空白 GPT 没有帮助)分区如下所示:

Command (? for help): p
Disk /dev/sdb: 125067264 sectors, 59.6 GiB
Model: Multi-Card      
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 76A0F070-E171-475B-9409-53840D61AD12
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 4194270
Partitions will be aligned on 2048-sector boundaries
Total free space is 671677 sectors (328.0 MiB)


Number  Start (sector)    End (sector)  Size       Code  Name
1            2048           67583   32.0 MiB    0C01  hassos-boot
2           67584          116735   24.0 MiB    8300  hassos-kernel0
3          116736          641023   256.0 MiB   8300  hassos-system0
4          641024          690175   24.0 MiB    8300  hassos-kernel1
5          690176         1214463   256.0 MiB   8300  hassos-system1
6         1214464         1230847   8.0 MiB     8300  hassos-bootstate
7         1230848         1427455   96.0 MiB    8300  hassos-overlay
8         1427456         3524607   1024.0 MiB  8300  hassos-data

当我想验证磁盘时,我会得到这个信息:

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 does not 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.

Identified 2 problems!

我可以设法解决这些问题,然后我得到了这个按摩:

No problems found. 121544637 free sectors (58.0 GiB) available in 2
segments, the largest of which is 121542623 (58.0 GiB) in size.

但在写完之后我得到了这个:

 OK: writing new GUID partition table (GPT) to /dev/sdb.
 The operation has completed successfully.

但是当我再次检查分区时,它仍然是一样的。我试图一个一个地删除所有分区,然后创建一个新的空 GUID 分区表,但写完后我得到了这个:

OK: writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.

但是当我再次检查分区时,它仍然是一样的。我认为这是因为混合 MBR 和损坏的 GPT。有没有办法同时删除这两个表?或者我还能做些什么来解决这个问题?

提前致谢

partitioning sd-card
  • 1 1 个回答
  • 10383 Views

1 个回答

  • Voted
  1. Best Answer
    Deltik
    2019-05-30T15:23:31+08:002019-05-30T15:23:31+08:00

    我实际上最近遇到了同样的问题。您的 SD 卡可能处于某种写保护模式。可能的原因:

    1. 闪存已经磨损,无法再写入。(这是不好的!)
    2. 可能启用了物理写保护开关。(将其关闭以再次启用写入。)

    在我的例子中,闪存盘控制器在闪存出现故障后默默地丢弃了我的写入,因此即使写入看起来成功,但损坏的分区表在下一次读取时又回来了。

    如果您的 SD 卡出现这种情况,很可能是它发生了故障,您需要换一张新卡。

    我怀疑您遇到了第一个问题,因为如果写保护开关处于活动状态,您会看到某种“只读”通知,因为 Linux 可以检测闪存盘或 SD 卡是否被写保护。(见/var/log/syslog)

    写保护闪存驱动器示例/dev/sdc:

    5 月 29 日 18:26:44 演示内核:[32319.722491] scsi 2:0:0:0:直接访问 NA NA 1.26 PQ:0 ANSI:5
    5 月 29 日 18:26:44 演示内核:[32319.723377] sd 2:0:0:0:附加 scsi 通用 sg1 类型 0
    5 月 29 日 18:26:44 演示内核:[32319.724325] sd 2:0:0:0: [sdc] 31266816 512 字节逻辑块:(16.0 GB/14.9 GiB)
    5 月 29 日 18:26:44 演示内核:[32319.725131] sd 2:0:0:0: [sdc] 写保护开启
    5 月 29 日 18:26:44 演示内核:[32319.725137] sd 2:0:0:0: [sdc] 模式感知:43 00 80 00
    5 月 29 日 18:26:44 演示内核:[32319.725389] sd 2:0:0:0: [sdc] 写入缓存:禁用,读取缓存:启用,不支持 DPO 或 FUA
    5 月 29 日 18:26:44 演示内核:[32319.737297] sdc:sdc1
    5 月 29 日 18:26:44 演示内核:[32319.739266] sd 2:0:0:0: [sdc] 附加的 SCSI 可移动磁盘
    

    演示

    /dev/sdb是我损坏的闪存驱动器静静地丢弃了写入。

    1. 尝试清除分区表:

      root@demo [~]# gdisk /dev/sdb
      GPT fdisk (gdisk) version 1.0.3
      
      Caution: invalid backup GPT header, but valid main header; regenerating
      backup header from main header.
      
      Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
      on the recovery & transformation menu to examine the two tables.
      
      Warning! One or more CRCs don't match. You should repair the disk!
      
      Partition table scan:
        MBR: hybrid
        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
      
      Command (? for help): p
      Disk /dev/sdb: 7897087 sectors, 3.8 GiB
      Model: USB Flash Disk
      Sector size (logical/physical): 512/512 bytes
      Disk identifier (GUID): 5904C65E-B410-474D-B22F-9FEA7E3582C2
      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 7897053
      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            4095   1024.0 KiB  EF02  BIOS boot partition
         2            4096          106495   50.0 MiB    EF00  EFI System
         3          106496         7897053   3.7 GiB     8300  Linux filesystem
      
      Command (? for help): x
      
      Expert command (? for help): z
      About to wipe out GPT on /dev/sdb. Proceed? (Y/N): y
      GPT data structures destroyed! You may now partition the disk using fdisk or
      other utilities.
      Blank out MBR? (Y/N): y
      
    2. 坏分区表立即返回:

      root@demo [~]# gdisk /dev/sdb
      GPT fdisk (gdisk) version 1.0.3
      
      Caution: invalid backup GPT header, but valid main header; regenerating
      backup header from main header.
      
      Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
      on the recovery & transformation menu to examine the two tables.
      
      Warning! One or more CRCs don't match. You should repair the disk!
      
      Partition table scan:
        MBR: hybrid
        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:
      
    3. 擦除磁盘的开头dd也没有任何效果:

      root@demo [~]# hexdump -C /dev/sdb | head
      00000000  eb 63 90 00 00 00 00 00  00 00 00 00 00 00 00 00  |.c..............|
      00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
      *
      00000050  00 00 00 00 00 00 00 00  00 00 00 80 00 08 00 00  |................|
      00000060  00 00 00 00 ff fa 90 90  f6 c2 80 74 05 f6 c2 70  |...........t...p|
      00000070  74 02 b2 80 ea 79 7c 00  00 31 c0 8e d8 8e d0 bc  |t....y|..1......|
      00000080  00 20 fb a0 64 7c 3c ff  74 02 88 c2 52 bb 17 04  |. ..d|<.t...R...|
      00000090  f6 07 03 74 06 be 88 7d  e8 17 01 be 05 7c b4 41  |...t...}.....|.A|
      000000a0  bb aa 55 cd 13 5a 52 72  3d 81 fb 55 aa 75 37 83  |..U..ZRr=..U.u7.|
      000000b0  e1 01 74 32 31 c0 89 44  04 40 88 44 ff 89 44 02  |[email protected].|
      root@demo [~]# dd if=/dev/zero of=/dev/sdb bs=1M count=1 status=progress
      1+0 records in
      1+0 records out
      1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0219383 s, 47.8 MB/s
      root@demo [~]# hexdump -C /dev/sdb | head
      00000000  eb 63 90 00 00 00 00 00  00 00 00 00 00 00 00 00  |.c..............|
      00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
      *
      00000050  00 00 00 00 00 00 00 00  00 00 00 80 00 08 00 00  |................|
      00000060  00 00 00 00 ff fa 90 90  f6 c2 80 74 05 f6 c2 70  |...........t...p|
      00000070  74 02 b2 80 ea 79 7c 00  00 31 c0 8e d8 8e d0 bc  |t....y|..1......|
      00000080  00 20 fb a0 64 7c 3c ff  74 02 88 c2 52 bb 17 04  |. ..d|<.t...R...|
      00000090  f6 07 03 74 06 be 88 7d  e8 17 01 be 05 7c b4 41  |...t...}.....|.A|
      000000a0  bb aa 55 cd 13 5a 52 72  3d 81 fb 55 aa 75 37 83  |..U..ZRr=..U.u7.|
      000000b0  e1 01 74 32 31 c0 89 44  04 40 88 44 ff 89 44 02  |[email protected].|
      
    • 0

相关问题

  • 在未分配空间的备份硬盘中安装 ubuntu

  • 如何完全擦除笔记本电脑磁盘以进行全新的 Ubuntu 安装?

  • 分区大小 128GB 但仅检测到 64GB [重复]

  • SD 卡和放大器

  • 我应该对用于存储的辅助(非操作系统)SSD 进行分区吗?[关闭]

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve