Command (? for help): p
Disk /dev/rdisk0s1: 3870731 sectors, 14.8 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): DA60F21F-DD91-4076-A4D3-632BA7F38079
Partition table holds up to 2 entries
First usable sector is 6, last usable sector is 3870725
Partitions will be aligned on 2-sector boundaries
Total free space is 0 sectors (0 bytes)
Number Start (sector) End (sector) Size Code Name
1 6 569545 2.2 GiB AF00 System
2 569546 3870725 12.6 GiB AF00 Data
第一分割區 開始區塊 6 結束區塊 569545
第二分割區 開始區塊 569546 結束區塊 3870725
1個區塊等於 4096-byte (4KB),區塊對齊也就是俗稱的4K對齊。
第二分割區修正
hfs_resize 調整可能無法對齊區塊,所以必須使用gptfdisk重新對齊資料分割區的區塊。
顯示分割區2的詳細信息
i 2
Command (? for help): i
Partition number (1-2): 2
Partition GUID code: 48465300-0000-11AA-AA11-00306543ECAC (Apple HFS/HFS+)
Partition unique GUID: 353A726C-E8E1-4A9C-BD2D-BF34F7810862
First sector: 569546 (at 2.2 GiB)
Last sector: 3870725 (at 14.8 GiB)
Partition size: 3301180 sectors (12.6 GiB)
Attribute flags: 0003000000000000
Partition name: 'Data'
Command (? for help): n
Using 2
First sector (569546-3870725, default = 569546) or {+-}size{KMGTP}:
Last sector (569546-3870725, default = 3870725) or {+-}size{KMGTP}: 1773574
Current type is 'Apple HFS/HFS+'
Hex code or GUID (L to show codes, Enter = AF00):
Changed type of partition to 'Apple HFS/HFS+'
修改第二分割區標籤為 Data
c 2 Data
Command (? for help): c
Partition number (1-2): 2
Enter name: Data
查看修改結果
p
Command (? for help): p
Disk /dev/rdisk0s1: 3870731 sectors, 14.8 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): DA60F21F-DD91-4076-A4D3-632BA7F38079
Partition table holds up to 2 entries
First usable sector is 6, last usable sector is 3870725
Partitions will be aligned on 2-sector boundaries
Total free space is 2097151 sectors (8.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 6 569545 2.2 GiB AF00 System
2 569546 1773574 4.6 GiB AF00 Data
修正第二分割區 Attribute flags
通常系統分割區 Attribute flags 為 0000000000000000
資料分割區 Attribute flags 為 0003000000000000
x a 2 48 49 ENTER
Command (? for help): x
Expert command (? for help): a
Partition number (1-2): 2
Known attributes are:
0: system partition
1: hide from EFI
2: legacy BIOS bootable
60: read-only
62: hidden
63: do not automount
Attribute value is 0000000000000000. Set fields are:
No fields set
Toggle which attribute field (0-63, 64 or <Enter> to exit): 48
Have enabled the 'Undefined bit #48' attribute.
Attribute value is 0001000000000000. Set fields are:
48 (Undefined bit #48)
Toggle which attribute field (0-63, 64 or <Enter> to exit): 49
Have enabled the 'Undefined bit #49' attribute.
Attribute value is 0003000000000000. Set fields are:
48 (Undefined bit #48)
49 (Undefined bit #49)
Toggle which attribute field (0-63, 64 or <Enter> to exit):
Expert command (? for help): c
Partition number (1-2): 2
Enter the partition's new unique GUID ('R' to randomize): 353A726C-E8E1-4A9C-BD2D-BF34F7810862
New GUID is 353A726C-E8E1-4A9C-BD2D-BF34F7810862
到此第二分割區搞定.....
建立第二系統分割區
修改分割表允許擁有4個分割區
s 4
Expert command (? for help): s
Current partition table size is 32.
Enter new size (32 up, default 128): 4
Caution: The partition table size should officially be 16KB or larger,
which works out to 128 entries. In practice, smaller tables seem to
work with most OSes, but this practice is risky. I'm proceeding with
the resize, but you may want to reconsider this action and undo it.
Adjusting GPT size from 4 to 32 to fill the sector
返回主選單
m
Expert command (? for help): m
Command (? for help):
建立第三分割區(為第二系統的系統分割區)
設定前須先確定要安裝的目標系統容量大小,然後計算第三分割區區塊大小,設置第三分割區結束區塊。
或者可以自行分配大一點的區塊給第三分割區
例如分配2.2GB的空間給第三分割區
2.2GB = 2248MB
2248*1024*1024=2357198848 byte
2357198848 / 4096 = 575488 (區塊大小)
開始區塊 + 區塊大小 = 結束區塊
1773576 + 575488 = 2349064
n 3 ENTER 2349064 ENTER
Command (? for help): n
Partition number (3-32, default 3): 3
First sector (3-3870728, default = 1773576) or {+-}size{KMGTP}:
Last sector (1773576-3870728, default = 3870728) or {+-}size{KMGTP}: 2349064
Current type is 'Apple HFS/HFS+'
Hex code or GUID (L to show codes, Enter = AF00):
Changed type of partition to 'Apple HFS/HFS+'
Command (? for help): n
Partition number (4-32, default 4): 4
First sector (3-3870728, default = 2349066) or {+-}size{KMGTP}:
Last sector (2349066-3870728, default = 3870728) or {+-}size{KMGTP}: 3870725
Current type is 'Apple HFS/HFS+'
Hex code or GUID (L to show codes, Enter = AF00):
Changed type of partition to 'Apple HFS/HFS+'
分割區標籤與第四分割區 Attribute flags,可以不用改
修改第三分割區標籤為 iOSFS
c 3 iOSFS
Command (? for help): c
Partition number (1-3): 3
Enter name: iOSFS
修改第四分割區標籤為 iOSData
c 4 iOSData
Command (? for help): c
Partition number (1-4): 4
Enter name: iOSData
設置第四分割區 Attribute flags
x a 4 48 49 ENTER
Command (? for help): x
Expert command (? for help): a
Partition number (1-4): 4
Known attributes are:
0: system partition
1: hide from EFI
2: legacy BIOS bootable
60: read-only
62: hidden
63: do not automount
Attribute value is 0000000000000000. Set fields are:
No fields set
Toggle which attribute field (0-63, 64 or <Enter> to exit): 48
Have enabled the 'Undefined bit #48' attribute.
Attribute value is 0001000000000000. Set fields are:
48 (Undefined bit #48)
Toggle which attribute field (0-63, 64 or <Enter> to exit): 49
Have enabled the 'Undefined bit #49' attribute.
Attribute value is 0003000000000000. Set fields are:
48 (Undefined bit #48)
49 (Undefined bit #49)
Toggle which attribute field (0-63, 64 or <Enter> to exit):
列出分割表
p
Command (? for help): p
Disk /dev/rdisk0s1: 3870731 sectors, 14.8 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): DA60F21F-DD91-4076-A4D3-632BA7F38079
Partition table holds up to 32 entries
First usable sector is 3, last usable sector is 3870728
Partitions will be aligned on 2-sector boundaries
Total free space is 8 sectors (32.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 6 569545 2.2 GiB AF00 System
2 569546 1773574 4.6 GiB AF00 Data
3 1773576 2349064 2.2 GiB AF00 Apple HFS/HFS+
4 2349066 3870725 5.8 GiB AF00 Apple HFS/HFS+
最後如果沒問題按 w 然後 Y 寫入
如果有問題按 q 退出,從頭開始
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/rdisk0s1.
Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
寫入之後按輸入幾次 sync
# sync
# sync
# sync
# sync
確認新的分割區是否出現
# ls /dev/disk*
/dev/disk0 /dev/disk0s1s1 /dev/disk0s1s3 /dev/disk1
/dev/disk0s1 /dev/disk0s1s2 /dev/disk0s1s4