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
    • 最新
    • 标签
主页 / server / 问题 / 1064597
Accepted
DenisZ
DenisZ
Asked: 2021-05-25 22:32:27 +0800 CST2021-05-25 22:32:27 +0800 CST 2021-05-25 22:32:27 +0800 CST

如何克隆带有坏扇区的 PMBR 磁盘?

  • 772

我正在尝试使用 PMBR 分区和坏扇区克隆 1TB 磁盘。它上面有工作的 Windows 分区,并且可以通过 MBR 启动。
blkid不识别分区

/dev/sdc: PTTYPE="PMBR"

gdisk /dev/sdc

    GPT fdisk (gdisk) version 1.0.7

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

Caution! After loading partitions, the CRC doesn't check out!
Warning: Invalid CRC on main header data; loaded backup partition table.
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!
Main header: ERROR
Backup header: OK
Main partition table: ERROR
Backup partition table: ERROR

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: 

我尝试gdisk使用 ( 2) ( r) ( b) ( w) 但结果不想写

 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
17599083851618035976 blocks!
You will need to delete this partition or resize it in another utility.

Problem: partitions 121 and 119 overlap:
  Partition 121: 925735787758310161 to 13474437941687892909
  Partition 119: 11147454187938441805 to 15638604846186930334

Problem: partitions 121 and 120 overlap:
  Partition 121: 925735787758310161 to 13474437941687892909
  Partition 120: 3391649715396322562 to 7297187905800799496

Problem: partitions 122 and 120 overlap:
  Partition 122: 3391649715396322562 to 7297187905800799496
  Partition 120: 3391649715396322562 to 7297187905800799496

Problem: partitions 122 and 121 overlap:
  Partition 122: 3391649715396322562 to 7297187905800799496
  Partition 121: 925735787758310161 to 13474437941687892909

Problem: partitions 123 and 119 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 119: 11147454187938441805 to 15638604846186930334

Problem: partitions 123 and 120 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 120: 3391649715396322562 to 7297187905800799496

Problem: partitions 123 and 121 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 121: 925735787758310161 to 13474437941687892909

Problem: partitions 123 and 122 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 122: 3391649715396322562 to 7297187905800799496

Problem: partitions 124 and 119 overlap:
  Partition 124: 10336404087008029236 to 15113227714779688721
  Partition 119: 11147454187938441805 to 15638604846186930334

Problem: partitions 124 and 121 overlap:
  Partition 124: 10336404087008029236 to 15113227714779688721
  Partition 121: 925735787758310161 to 13474437941687892909

Problem: partitions 124 and 123 overlap:
  Partition 124: 10336404087008029236 to 15113227714779688721
  Partition 123: 925735787758310161 to 13474437941687892909
Aborting write operation!
Aborting write of new partition table.

clonezilla 无法识别我尝试过 gparted 的分区,Rescue system partitions 但它整晚都在扫描,什么也没有。
使用: cfdisk /dev/sdc 工作正常

                                                                              Disk: /dev/sdc
                                                        Size: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
                                                                    Label: dos, identifier: 0x9f9fd106

    Device                 Boot                              Start                   End               Sectors              Size            Id Type
>>  /dev/sdc1                                                    1                206846                206846              101M            ee GPT                        
    /dev/sdc2              *                                206848             617201663             616994816            294.2G             7 HPFS/NTFS/exFAT
    /dev/sdc3                                            617201664            1916342271            1299140608            619.5G             7 HPFS/NTFS/exFAT
    /dev/sdc4                                           1916342272            1953316862              36974591             17.6G            c0 unknown
    Free space                                          1953316864            1953525167                208304            101.7M     

                                 

如何在 fedora 或 PartedMagic live 下挂载分区?谢谢

mbr clonezilla rescue-disk
  • 2 2 个回答
  • 395 Views

2 个回答

  • Voted
  1. DenisZ
    2021-05-26T11:35:57+08:002021-05-26T11:35:57+08:00

    我最终使用了 Nikita 的提示,并进行了仿真
    qemu-img create -f qcow2 -b /dev/sdc -F raw /tmp/snap.qcow2
    dnf install nbd
    modprobe nbd
    qemu-nbd -c /dev/nbd0 /tmp/snap.qcow2
    gdisk /dev/ndb0
    然后我使用 2,r(恢复),l(加载 MBR 并创建 GPT - 因为 GPT 分区已损坏), w(写入磁盘)
    clonezilla不想工作,因为新磁盘更小并且即使他们建议使用-C在命令行中跳过检查目标磁盘大小,但它不起作用。所以直接镜像的命令行将是(使用 clonezilla)
    sbin/ocs-onthefly -g auto -e1 auto -e2 -j2 -r -rescue -icds -C -v -sfsck -k -pa choose -f nbd1 -t sdb

    我必须在新磁盘中手动创建分区,格式化它们,mount然后使用rsync
    最后一步是启动到 Windows 安装 USB - 修复模式。转到command prompt
    diskpart
    里面选择
    list vol - 列出卷
    sel vol X - 选择 UEFI 引导的第一个 FAT32 分区的 卷 - 如果您需要传统引导,则
    assign letter b:分配能够写入引导 efi 引导
    bcdboot c:\Windows /l en-us /s c: /f All 写入 MBR 记录的字母(假设系统磁盘在 C: 下
    bcdboot c:\Windows /s b: /f UEFI ) - 写入 EFI引导记录到 EFI 分区,以便您可以在新机器上引导。

    它必须手动完成,但实际上它会比使用 clonezilla、ddrescue、尝试保存/复制分区更快。因此,如果您遇到类似的问题,您可以节省一些时间。
    问候

    • 1
  2. Best Answer
    Nikita Kipriyanov
    2021-05-25T23:17:25+08:002021-05-25T23:17:25+08:00

    始终从对磁盘进行扇区级备份开始。用例如ddrescue,甚至类似的东西dd conv=noerror,notrunc,sync,或者你认为合适的任何东西来做。低级工具是首选,因为它们可以让您更好地控制正在发生的事情。

    我怀疑磁盘的某些前导扇区坏了。这就是为什么恢复 GPT 不能很好地工作的原因。如果是这种情况(您可以通过读取dmesg或检查备份后的输出dd或日​​志文件来检查这一点ddrescue),您可能会成功执行以下操作:将此扇区级备份转储到与失败备份完全相同大小的设备上。然后尝试恢复克隆设备上的分区表。

    另外,如果你得到的分区表cfdisk是正确的,你可以尝试在内核中“手动”设置分区块设备partx或kpartx(请阅读man partx详细信息)。


    在不使用相同大小的附加设备的情况下执行所有恢复操作的有希望的方法是使用 qemu 虚拟磁盘。您设置了支持设备的映像覆盖,这将是您的故障磁盘或更好的备份映像文件:

    qemu-img create -f qcow2 -b /dev/sdX -F raw /tmp/snap.qcow2
    

    /tmp必须有足够的空间来容纳所有“更新”的扇区,具体取决于可能从几十兆字节到几千兆字节不等的故障规模。sdX是您的故障设备。

    现在,将映像作为网络块设备附加到系统:

    qemu-nbd -c /dev/nbd0 /tmp/snap.qcow2
    

    您可能需要先加载模块nbd。

    对 的写入/dev/nbd0将最终写入snap.qcow2,如果有这样的扇区,将从它执行读取,如果映像中仍然没有这样的扇区,则从后端设备执行读取。现在,在 上执行所有恢复操作/dev/nbd0,例如,尝试在其上修复 GPT,然后恢复分区。

    • 0

相关问题

  • Windows 7 更新杀死引导扇区

  • DOS 和 Solaris MBR 有什么区别?

  • 在不修改 MBR 的情况下安装 Windows 7 [关闭]

Sidebar

Stats

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

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve