linux – dd图像太大无法恢复

我用dd做了一个图像

sudo dd if=/dev/sda of=/path_to_external_drive/backup.img

现在我想在所有分区的安装顺利进行后恢复系统.当我做

sudo dd if=backup.img of=/dev/sda

在尝试引导系统之前,我没有收到任何错误消息.

我从sudo fdisk -l收到以下错误消息,因为我想知道为什么BIOS没有找到任何分区.

分区1不在物理扇区边界上开始

所以我从我的实时棒中尝试了Disk Image Writer,但它说,图像是41 kB太大了.

怎么会发生这种情况,我该如何解决?除了购买新的SSD之外还有另一种方法来恢复系统吗?

fdisk -l backup.img:

linux  –  dd图像太大无法恢复
fdisk -l / dev / sda:

GPT PMBR size mismatch (976773247 != 976773167) will be corrected by w(rite).

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x635f93a2

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1           1 976773247 976773247 465.8G ee GPT

Partition 1 does not start on physical sector boundary.

gdisk -l / dev / sda:

GPT fdisk (gdisk) version 1.0.1

Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Disk /dev/sda: 976773168 sectors, 465.8 GiB  
Logical sector size: 512 bytes  
Disk identifier (GUID): 8DC2A4AA-C369-4ED8-B876-DCE0418A1BD0  
Partition table holds up to 128 entries  
First usable sector is 34, last usable sector is 976773214  
Partitions will be aligned on 2048-sector boundaries

Total free space is 4157 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name  
   1            2048          923647   450.0 MiB   2700  Basic data partition  
   2          923648         1128447   100.0 MiB   EF00  EFI system partition  
   3         1128448         1161215   16.0 MiB    0C01  Microsoft reserved ...  
   4         1161216       669571071   318.7 GiB   0700  Basic data partition  
   5       669571072       960290815   138.6 GiB   8300  
   6       960290816       976771071   7.9 GiB     8200  

解决方法:

您的映像文件比磁盘大40KB(976773248 – 976773168扇区).它无法将整个映像dd写入磁盘.我猜你的dd命令显示了一些警告,比如“没有剩余空间”等等.

但你有运气.最后一个(第6个)分区只是一个交换分区.您可以使用gdisk和mkswap调整最后一个分区的大小并更正分区表:

$gdisk / dev / sda

>删除最后一个分区
>修复gpt分区表(应该自动完成)
>重新创建最后一个分区(将比以前小一点)

然后格式化新的交换分区:

$mkswap /dev/sda6

有关交互式gdisk使用的注意事项:

我无法预测gdisk / dev / sda会告诉你什么.输入“h”获取帮助.键入“d”,然后键入“6”以删除最后一个分区. “n”和“6”重新创建最后一个分区.退出并用“w”写下您的更改.除非您以“w”退出,否则gdisk不会写任何内容.如果不确定您可以随时通过“q”或“ctrl-c”退出/取消.

上一篇:git教程学习笔记(5)


下一篇:c – Qt – 如何为我的应用程序保存数据