擁抱自由,使用 linux !

在Linux底下真是太幸福了,有好多東西可以玩。想從windows解脫就是現在!

最近剛好有台 apple macbook 想要換大硬碟,這邊 有些很經典的作法,但是我希望用些不一樣的方式,想當然就是用 clonezilla。目前 Clonezilla 可以備份 apple 的電腦,所以想要直接硬幹(Linux, windows 大部份都會自動resize),但是 osx 不能自動 resize, 因為沒有 tool 可以用;無所謂,那就用 osx 自己的 diskutils 去做 resize。

硬幹的結果就是 resize fail,相似的問題,類似這樣…

http://ubuntuforums.org/showthread.php?t=760190

MediaKit reports partition (map) too small
也就是說把硬碟直接對考,之後 resize 會有錯誤,因為 GPT (clonezilla 用 dd 的方式備份) 已經認定硬碟大小,之後用diskutils去拉大、或是新增磁區、甚至是任何變動都會失敗,真是爛到不行。
正確的作法應該是利用gdisk去產生正確的GPT表:
Backup 備份時:
先用 gdisk 備份 GPT  // GPT backup with gdisk
root@T17:/home/thomas/Desktop# gdisk /dev/sdd
GPT fdisk (gdisk) version 0.6.3

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

Found valid GPT with protective MBR; using GPT.

Command (? for help): b
Enter backup filename to save: backup
The operation has completed successfully.

Command (? for help): q
root@T17:/home/thomas/Desktop#

備份 partition // clone partition with partclone
ocs-live ….

Restore 還原時:
用 gdisk 還原 GPT // Restore GPT with gdisk
gdisk /dev/sddd
r
Recovery/transformation command (? for help): l
Enter backup filename to load: gpt-backup
Warning! Current disk size doesn’t match that of the backup!
Adjusting sizes to match, but subsequent problems are possible!

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed, possibly destroying your data? (Y/N):

OK; writing new GUID partition table (GPT).
The operation has completed successfully.
root@T17:/home/thomas/Desktop# gdisk -l /dev/sdd
GPT fdisk (gdisk) version 0.6.3

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

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdd: 625142448 sectors, 298.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E75560D0-CBAA-4DC8-9515-967D8A397616
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 625142414
Total free space is 312822797 sectors (149.2 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
1              40          409639   200.0 MiB   EF00  EFI System Partition
2          409640       312319623   148.7 GiB   AF00  Apple_HFS_Untitled_1

還原 partition // restore partition with partclone
ocs-live …

之後可以開機使用 osx diskutils 工具,直接拉開就可以resize!

then, osx diskutils to enlarge or add partition successfully.
一些好玩的資料:
什麼是GPT WIKI 有說明
APPLE OSX 電腦磁區切割的秘密 (Partitioning Policy)
第一個EFI分割區的用途
UEFI 是啥?(定義)
結論與疑問:
1. 如果要手動增加osx partition 必須依照 osx Partition Policy 才行??
2. EFI 磁區用 FAT 的方式備份,不一定成功,目前成功應該是因為APPLE還沒有在用??

Add A Comment