
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は物理セクター境界から始まっていません
そこで、ライブ スティックからディスク イメージ ライターを試してみましたが、イメージが 41 KB 大きすぎるというメッセージが表示されます。
なぜこのようなことが起こるのでしょうか? また、どうすれば修正できるのでしょうか? 新しい SSD を購入する以外に、システムを復元する方法はありますか?
fdisk -l バックアップ.img:
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
答え1
イメージ ファイルはディスクより 40 KB 大きいです (976773248 - 976773168 セクター)。イメージ全体をディスクにコピーすることはできませんdd
。dd コマンドで「空き領域がありません」などの警告が表示されたと思います。
gdisk and mkswap
しかし、運が良ければ、最後の (6 番目の) パーティションは単なるスワップ パーティションです。最後のパーティションのサイズを変更し、パーティション テーブルを修正するには、次のようにします。
$ gdisk /dev/sda
- 最後のパーティションを削除する
- gpt パーティション テーブルを修復します (自動的に実行されるはずです)
- 最後のパーティションを再作成します(以前よりも少し小さくなります)
次に、新しいスワップ パーティションをフォーマットします。
$ mkswap /dev/sda6
gdisk
インタラクティブな使用に関する注意事項:
何が表示されるかは予測できませんgdisk /dev/sda
。ヘルプを表示するには「h」と入力します。最後のパーティションを削除するには「d」と「6」と入力します。最後のパーティションを再作成するには「n」と「6」と入力します。終了して「w」で変更を書き込みます。gdisk は「w」で終了しない限り何も書き込みません。不明な場合はいつでも「q」または「ctrl-c」で終了/キャンセルできます。