(assuming the external drive has been identified as "disk1").diskutil list/dev/disk1
It is interesting to note that there is an unnamed partition of type "EFI" and of size 200.0MB that has been created at the beginning of the drive by DiskUtil (with identifier disk1s1). It is because we chose "GUID Partition Table" as option./dev/disk1
#: type name size identifier
0: GUID_partition_scheme *186.3 GB disk1
1: EFI 200.0 MB disk1s1
2: Apple_HFS TigerGPT 31.9 GB disk1s2
3: Apple_HFS LeopardGPT 31.9 GB disk1s3
4: Microsoft Basic Data XPGPT 32.0 GB disk1s4
5: Microsoft Basic Data VISTAGPT 32.0 GB disk1s5
6: Microsoft Basic Data FATGPT 32.0 GB disk1s6
7: Apple_UFS SwapGPT 1.9 GB disk1s7
8: Apple_UFS LinuxGPT 24.0 GB disk1s8
is as follows:gpt show/dev/rdisk1
The index block start of each partition and the block count are displayed. If we could just load those numbers into a Linux fdisk utility, we could easily synchronize GPT and MBR on the external disk.gpt show:/dev/rdisk1: Suspicious MBR at sector 0
start size index contents
0 1 MBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 66846720 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
67256360 262144
67518504 66846720 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
134365224 262144
134627368 67108864 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
201736232 67108864 5 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
268845096 67108864 6 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
335953960 3932160 7 GPT part - 55465300-0000-11AA-AA11-00306543ECAC
339886120 262144
340148264 50311520 8 GPT part - 55465300-0000-11AA-AA11-00306543ECAC
390459784 262151
390721935 32 Sec GPT table
390721967 1 Sec GPT header
displays the following information once we type print at the interactive prompt.fdisk -e/dev/rdisk1
It is interesting to note that the MBR information is not empty. On the contrary, it has been smartly initialized by MacOS to include the 4 first meaningful partitions of the disk. This includes the 200.0MB unnammed EFI partition at the beginning of the disk, the two MacOS Extended partitions (TigerGPT and LeopardGPT) and the first Windows partition (XPGPT). The two small 128MB partitions of 262144 blocks that follow the HFS+ partitions have been literally skipped by the default MacOS synch behavior between GPT and MBR.fdisk: could not open MBR file/usr/standalone/i386/boot0: No such file or directory
Enter 'help' for information
fdisk: 1> print
Disk:/dev/rdisk1 geometry: 24321/255/63 [390721968 sectors]
Offset: 0 Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: AF 1023 254 63 - 1023 254 63 [ 409640 - 66846720] HFS+
3: AF 1023 254 63 - 1023 254 63 [ 67518504 - 66846720] HFS+
4: 0B 1023 254 63 - 1023 254 63 [ 134627368 - 67108864] Win95 FAT-32
Then, edit 2 and follow through with the wizard. We enter the values that were displayed by gpt for the first Windows partition (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7) that we are interested in. The same is done with edit 3 for the second Windows partiton. Then for the next partition, we will create an extended partition via edit 4. Then we need to type select 4 to add a new MBR inside that extended partition. And again edit 1 and edit 2. This first extended partition will contain FATGPT, plus another extended partition. Type select 2 to enter this nes extended partition and initialize it with a fresh MBR. This new extended partition will contain the SwapGPT partition. And another extended partition. That last extended partition will contain the LinuxGPT partition.erase
shows the following informationfdisk/dev/rdisk1
Since we have fdisk at hand, we used it to also set a more fine-grained partition type for each partition: twice 07 for NTFS, 05 for extended, 0B for FAT32, 82 for Linux Swap and 83 for Linux.Disk:/dev/rdisk1 geometry: 24321/255/63 [390721968 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: 07 1023 254 63 - 1023 254 63 [ 134627368 - 67108864] HPFS/QNX/AUX
3: 07 1023 254 63 - 1023 254 63 [ 201736232 - 67108864] HPFS/QNX/AUX
4: 05 1023 254 63 - 1023 254 63 [ 268845096 - 121614688] Extended DOS
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 0B 1023 254 63 - 1023 254 63 [ 268845159 - 67108738] Win95 FAT-32
2: 05 1023 254 63 - 1023 254 63 [ 335953897 - 54505887] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 82 1023 254 63 - 1023 254 63 [ 335953960 - 3932160] Linux swap
2: 05 1023 254 63 - 1023 254 63 [ 340148264 - 50311520] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 83 1023 254 63 - 1023 254 63 [ 340148327 - 50311457] Linux files*
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
The MBR data for the same partition says the following correct information:268845096 67108864 6 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
We can correct the GPT information the following way:1: 0B 1023 254 63 - 1023 254 63 [ 268845159 - 67108738] Win95 FAT-32
If we look now at the output from# gpt remove -b 268845096/dev/rdisk1
gpt remove:/dev/rdisk1: Suspicious MBR at sector 0
gpt remove:/dev/rdisk1: 1 partition(s) removed
# gpt add -b 268845159 -s 67108738 -i 6 -t windows/dev/rdisk1
gpt add:/dev/rdisk1: Suspicious MBR at sector 0
, we can see that the FAT-32 partition now has the same size and the same starting block in GPT and in MBR. Note also the two 63-block partitions before and after it. Those are two of the extended partitions.gpt show/dev/rdisk1
The same can be done with the LinuxGPT partition:gpt show:/dev/rdisk1: Suspicious MBR at sector 0
start size index contents
0 1 MBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 66846720 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
67256360 262144
67518504 66846720 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
134365224 262144
134627368 67108864 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
201736232 67108864 5 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
268845096 63
268845159 67108738 6 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
335953897 63
335953960 3932160 7 GPT part - 55465300-0000-11AA-AA11-00306543ECAC
339886120 262144 4
340148264 50311520 8 GPT part - 55465300-0000-11AA-AA11-00306543ECAC
390459784 262151
390721935 32 Sec GPT table
390721967 1 Sec GPT header
Looking at the output of diskutil list# gpt remove -b 340148264/dev/rdisk1
gpt remove:/dev/rdisk1: Suspicious MBR at sector 0
gpt remove:/dev/rdisk1: 1 partition(s) removed
# gpt add -b 340148327 -s 50311457 -i 8 -t 55465300-0000-11AA-AA11-00306543ECAC/dev/rdisk1
gpt add:/dev/rdisk1: Suspicious MBR at sector 0
This is disk1s6 and disk1s8. As such, they are not mounted by MacOS anymore. Well, for disk1s8, it is not so much of a problem because it will contain a Linux distribution, and we don't necessarily want MacOS to peak into it. But for disk1s6 -- which used to be called FATGPT --, it is a problem because it is the partition that will be used by all operating systems to exchange files together. Hopefully, we will be able to fix that once we reboot under Windows./dev/disk1
#: type name size identifier
0: GUID_partition_scheme *186.3 GB disk1
1: EFI 200.0 MB disk1s1
2: Apple_HFS TigerGPT 31.9 GB disk1s2
3: Apple_HFS LeopardGPT 31.9 GB disk1s3
4: Microsoft Basic Data XPGPT 32.0 GB disk1s4
5: Microsoft Basic Data VISTAGPT 32.0 GB disk1s5
6: Microsoft Basic Data 32.0 GB disk1s6
7: Apple_UFS SwapGPT 1.9 GB disk1s7
8: Apple_UFS 24.0 GB disk1s8
gpt show:/dev/rdisk1: Suspicious MBR at sector 0
start size index contents
0 1 MBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 66846720 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
67256360 262144
67518504 66846720 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
134365224 262144
134627368 67108864 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
201736232 67108864 5 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
268845096 63
268845159 67108738 6 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
335953897 63
335953960 3932160 7 GPT part - 55465300-0000-11AA-AA11-00306543ECAC
339886120 262207 4
340148327 50311457 8 GPT part - 55465300-0000-11AA-AA11-00306543ECAC
390459784 262151
390721935 32 Sec GPT table
390721967 1 Sec GPT header
shows the following output:diskutil list/dev/disk1
Now, let's go back to Windows and try to clone the XP partition from the internal hard drive into XPGPT on the external gard drive./dev/disk1
#: type name size identifier
0: GUID_partition_scheme *186.3 GB disk1
1: EFI 200.0 MB disk1s1
2: Apple_HFS TigerGPT 31.9 GB disk1s2
3: Apple_HFS LeopardGPT 31.9 GB disk1s3
4: Microsoft Basic Data XPGPT 32.0 GB disk1s4
5: Microsoft Basic Data VISTAGPT 32.0 GB disk1s5
6: Microsoft Basic Data FATMBR 32.0 GB disk1s6
7: Apple_UFS SwapGPT 1.9 GB disk1s7
8: Apple_UFS 24.0 GB disk1s8
The partitionning actually changed the size and the block start value of the XPGPT partition. It reads nowDisk:/dev/rdisk1 geometry: 24321/255/63 [390721968 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
*1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: 07 1023 0 1 - 1023 254 63 [ 134624700 - 67103505] HPFS/QNX/AUX
3: 07 1023 254 63 - 1023 254 63 [ 201736232 - 67108864] HPFS/QNX/AUX
4: 0F 1023 212 31 - 1023 254 22 [ 268845096 - 121614688] Extended LBA
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 0B 1023 254 63 - 1023 254 63 [ 268845159 - 67108738] Win95 FAT-32
2: 05 1023 254 63 - 1023 254 63 [ 335953897 - 54505887] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 82 1023 254 63 - 1023 254 63 [ 335953960 - 3932160] Linux swap
2: 05 1023 254 63 - 1023 254 63 [ 340148264 - 50311520] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 83 1023 254 63 - 1023 254 63 [ 340148327 - 50311457] Linux files*
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
instead of the previous info, which was:2: 07 1023 0 1 - 1023 254 63 [ 134624700 - 67103505] HPFS/QNX/AUX
The partition is basically shorter: 67,103,505 blocks vs 67,108,864. And it starts earlier on the disk: at block number 134,624,700 instead of 134,627,368. That's 2668 blocks too early!2: 07 1023 254 63 - 1023 254 63 [ 134627368 - 67108864] HPFS/QNX/AUX
All trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the Poster. The Rest © 1997-2008 SourceForge, Inc.