我正在尝试使用 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 下挂载分区?谢谢
我最终使用了 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、尝试保存/复制分区更快。因此,如果您遇到类似的问题,您可以节省一些时间。
问候
始终从对磁盘进行扇区级备份开始。用例如
ddrescue
,甚至类似的东西dd conv=noerror,notrunc,sync
,或者你认为合适的任何东西来做。低级工具是首选,因为它们可以让您更好地控制正在发生的事情。我怀疑磁盘的某些前导扇区坏了。这就是为什么恢复 GPT 不能很好地工作的原因。如果是这种情况(您可以通过读取
dmesg
或检查备份后的输出dd
或日志文件来检查这一点ddrescue
),您可能会成功执行以下操作:将此扇区级备份转储到与失败备份完全相同大小的设备上。然后尝试恢复克隆设备上的分区表。另外,如果你得到的分区表
cfdisk
是正确的,你可以尝试在内核中“手动”设置分区块设备partx
或kpartx
(请阅读man partx
详细信息)。在不使用相同大小的附加设备的情况下执行所有恢复操作的有希望的方法是使用 qemu 虚拟磁盘。您设置了支持设备的映像覆盖,这将是您的故障磁盘或更好的备份映像文件:
/tmp
必须有足够的空间来容纳所有“更新”的扇区,具体取决于可能从几十兆字节到几千兆字节不等的故障规模。sdX
是您的故障设备。现在,将映像作为网络块设备附加到系统:
您可能需要先加载模块
nbd
。对 的写入
/dev/nbd0
将最终写入snap.qcow2
,如果有这样的扇区,将从它执行读取,如果映像中仍然没有这样的扇区,则从后端设备执行读取。现在,在 上执行所有恢复操作/dev/nbd0
,例如,尝试在其上修复 GPT,然后恢复分区。