全体は 500GBハードディスク(B)から 120GBのSSD(C)へのクローンです
使用した機材は
ですが
500 GB ハードディスクから
120 GB SSD に
この機械で複製することはできません、当然です
ためにこの記事を書きました
ハードディスクはいつクラッシュするかもわからないのでその時のためにクローンがいります
1)Bディスクの準備
gparted をもちいて Cに入る容量に Bを縮小します
2)Cディスクの準備 (まっさらにします)
# dd if=/dev/zero of=/dev/sdc bs=512 count=16000
-----
# gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.9
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!
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! Main partition table CRC mismatch! Loaded backup partition table
instead of main partition table!
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: OK
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: damaged
Found invalid MBR and corrupt GPT. What do you want to do? (Using the
GPT MAY permit recovery of GPT data.)
1 - Use current GPT
2 - Create blank GPT
Your answer: 2 <ーーここ
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdc.
The operation has completed successfully.
3) クローンの実行
# fdisk -l で様子を見ます
ディスク /dev/sdb: 465.76 GiB, 500107862016 バイト, 976773168 セクタ
デバイス 開始位置 終了位置 セクタ サイズ タイプ
/dev/sdb1 4096 618495 614400 300M EFI システム
/dev/sdb2 618496 234434559 233816064 111.5G Linux ファイルシステム
ディスク /dev/sdc: 111.79 GiB, 120034123776 バイト, 234441648 セクタ
ーーーーーー
そして
# dd if=/dev/sdb of=/dev/sdc bs=512 count=16000
16000+0 records in
16000+0 records out
8192000 bytes (8.2 MB, 7.8 MiB) copied, 0.390109 s, 21.0 MB/s
すると
# gdisk -l /dev/sdb
Number Start (sector) End (sector) Size Code Name
1 4096 618495 300.0 MiB EF00
2 618496 234434559 111.5 GiB 8300 root
# gdisk -l /dev/sdc
GPT: damaged <ーーアッチッチ
Number Start (sector) End (sector) Size Code Name
1 4096 618495 300.0 MiB EF00
2 618496 234434559 111.5 GiB 8300 root
と骨格はクローンされてますが、いけないところがあるので
# gdisk /dev/sdc してなおしましょう
GPT fdisk (gdisk) version 1.0.9
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.
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: OK
Backup header: OK
Main partition table: OK
Backup partition table: ERROR
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.
****************************************************************************
Command (? for help): p
Disk /dev/sdc: 234441648 sectors, 111.8 GiB
Model: 00 SSD
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): ED07EAE6-A001-6142-AF50-8DCAAF6501E7
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 2048, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 742340623 sectors (354.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 4096 618495 300.0 MiB EF00
2 618496 234434559 111.5 GiB 8300 root
Command (? for help): w <ーーここ
Caution! Secondary header was placed beyond the disk's limits! Moving the
header, but other problems may occur!
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdc.
The operation has completed successfully.
ーーーーーーーー
やっとクローンの実行です
# dd if=/dev/sdb1 of=/dev/sdc1 bs=16k
# dd if=/dev/sdb2 of=/dev/sdc2 bs=16k
##4) 確認
これでおしまいです、おつかれさま
でコーヒ一服