Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Returning Partition Table

Hi all,


it looks like this is the best place to ask a question on partitioning. I'm not that experience on this front hence getting myself into this pickle.


I used to have the standard MBR bootcamp partition, with Windows and OSX, also had rEFInd setup nicely for boot options, but wanted to slightly expand the Windows partition. I booted in recovery mode, used disk utility to shrink the OSX partition, this is when I found out that I wouldn't simply be able to boot restart the laptop and expand the Windows partition into the now free space. I finally managed to follow a guide that helped me fix the issue by rebuilding the partition table, for the current state of the volume, but I would like to just return it to my previous clean setup.


So I'd like to re-expand my OSX partition back to how it was and restore the previous partition table with EFI.


Could someone please instruct me on how to do this. I know I'll have to expand the OSX partition which will cause it to break again, but instructions from that point onwards would be really appreciated.


The output from "sudo gdisk /dev/disk0" is:


MBR: hybrid


BSD: not present


APM: not present


GPT: present

The output from "diskutil list" is:

/dev/disk0 (internal, physical):

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *240.1 GB
disk0

1: EFI EFI 209.7 MB
disk0s1

2: Apple_HFS Macintosh HD 90.0 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB
disk0s3

4: Apple_HFS Untitled 34.1 GB disk0s4

5: Microsoft Basic Data BOOTCAMP 115.0 GB
disk0s5


/dev/disk1 (disk image):

#: TYPE NAME SIZE IDENTIFIER

0: Apple_partition_scheme +20.4 MB disk1

1: Apple_partition_map 32.3 KB disk1s1

2: Apple_HFS Flash Player 20.4 MB disk1s2

Thanks so much for your help in advance,

Seb

Posted on Mar 9, 2018 12:27 PM

Reply

Similar questions

41 replies

Mar 10, 2018 7:51 AM in response to SebPinski

Boot into Internet Recovery (Reboot and hold Command+Opt+R), till you see a spinning globe or are asked for a wireless password. Once in Recovery console, click on Utilities -> Terminal, and run


diskutil unmountDisk disk0

gpt remove -i 4 /dev/disk0

gpt add -i 3 -b 177461248 -s 291399680 -t windows /dev/disk0

gpt -vv -r show /dev/disk0

diskutil repairDisk disk0


Please stop and post any errors you get. If you do not see any errors, reboot normally, and use the Rebuild MBR section of Re: El Capitan has deleted my bootcamp windows partition as a reference. You do not need to rebuild the GPT, and the partitions in step 6 are 2 3, not 2 3 4, since you do not have GPT4. GPT3 should be marked bootable.

Mar 12, 2018 10:39 AM in response to Loner T

OK, I think I'm on the final straight.


I managed to rebuild the GPT. I'm just following the instructions now in the link you gave. So I expected the list of instructions to be modified as follows:


  1. Sudo gdisk /dev/rdisk0
  2. P (Print list of parts)
  3. R (Recover)
  4. O (print current Hybrid MBR)
  5. H (chooses Hybrid)
  6. Partitions numbers to be hybridized: 2 3
  7. Y (Good for GRUB question)
  8. N (part 2 boot flag)
  9. Y (part 3 boot flag make NTFS bootable partition)
  10. O (print current Hybrid MBR)
  11. W (Write the new MBR)
  12. Y (Yes! write the new MBR)
  13. Reboot


After pressing enter at step 9, I got an unexpected question and am not sure how to respond:


"Unused partition space(s) found. Use one to protect more partitions? (Y/N)"


Not actually sure what this means and am unsure how to answer.


Thanks for all of your help so far, I really appreciate it!!!

Mar 9, 2018 1:11 PM in response to Loner T

I've been frantically trying to find the previous guide but no luck.


The output from the command was:


00000000
eb 52 90 4e 54 46 53 20
20 20 20 00 02 08 00 00
|.R.NTFS .....|

00000010
00 00 00 00 00 f8 00 00
3f 00 ff 00 00 10 8f 0e
|........?.......|

00000020
00 00 00 00 80 00 80 00
8e 1c 55 0d 00 00 00 00
|..........U.....|

00000030
00 00 0c 00 00 00 00 00
45 33 d6 00 00 00 00 00
|........E3......|

00000040
f6 00 00 00 01 00 00 00
0a d2 6e a4 dd 6e a4 c4
|..........n..n..|

00000050
00 00 00 00 fa 33 c0 8e
d0 bc 00 7c fb 68 c0 07
|.....3.....|.h..|

00000060
1f 1e 68 66 00 cb 88 16
0e 00 66 81 3e 03 00 4e
|..hf......f.>..N|

00000070
54 46 53 75 15 b4 41 bb
aa 55 cd 13 72 0c 81 fb
|TFSu..A..U..r...|

00000080
55 aa 75 06 f7 c1 01 00
75 03 e9 dd 00 1e 83 ec
|U.u.....u.......|

00000090
18 68 1a 00 b4 48 8a 16
0e 00 8b f4 16 1f cd 13
|.h...H..........|

000000a0
9f 83 c4 18 9e 58 1f 72
e1 3b 06 0b 00 75 db a3
|.....X.r.;...u..|

000000b0
0f 00 c1 2e 0f 00 04 1e
5a 33 db b9 00 20 2b c8
|........Z3... +.|

000000c0
66 ff 06 11 00 03 16 0f
00 8e c2 ff 06 16 00 e8
|f...............|

000000d0
4b 00 2b c8 77 ef b8 00
bb cd 1a 66 23 c0 75 2d
|K.+.w......f#.u-|

000000e0
66 81 fb 54 43 50 41 75
24 81 f9 02 01 72 1e 16
|f..TCPAu$....r..|

000000f0
68 07 bb 16 68 52 11 16
68 09 00 66 53 66 53 66
|h...hR..h..fSfSf|

00000100
55 16 16 16 68 b8 01 66
61 0e 07 cd 1a 33 c0 bf
|U...h..fa....3..|

00000110
0a 13 b9 f6 0c fc f3 aa
e9 fe 01 90 90 66 60 1e
|.............f`.|

00000120
06 66 a1 11 00 66 03 06
1c 00 1e 66 68 00 00 00
|.f...f.....fh...|

00000130
00 66 50 06 53 68 01 00
68 10 00 b4 42 8a 16 0e
|.fP.Sh..h...B...|

00000140
00 16 1f 8b f4 cd 13 66
59 5b 5a 66 59 66 59 1f
|.......fY[ZfYfY.|

00000150
0f 82 16 00 66 ff 06 11
00 03 16 0f 00 8e c2 ff
|....f...........|

00000160
0e 16 00 75 bc 07 1f 66
61 c3 a1 f6 01 e8 09 00
|...u...fa.......|

00000170
a1 fa 01 e8 03 00 f4 eb
fd 8b f0 ac 3c 00 74 09
|............<.t.|

00000180
b4 0e bb 07 00 cd 10 eb
f2 c3 0d 0a 41 20 64 69
|............A di|

00000190
73 6b 20 72 65 61 64 20
65 72 72 6f 72 20 6f 63
|sk read error oc|

000001a0
63 75 72 72 65 64 00 0d
0a 42 4f 4f 54 4d 47 52
|curred...BOOTMGR|

000001b0
20 69 73 20 63 6f 6d 70
72 65 73 73 65 64 00 0d
| is compressed..|

000001c0
0a 50 72 65 73 73 20 43
74 72 6c 2b 41 6c 74 2b
|.Press Ctrl+Alt+|

000001d0
44 65 6c 20 74 6f 20 72
65 73 74 61 72 74 0d 0a
|Del to restart..|

000001e0
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
|................|

000001f0
00 00 00 00 00 00 8a 01
a7 01 bf 01 00 00 55 aa
|..............U.|

00000200
07 00 42 00 4f 00 4f 00
54 00 4d 00 47 00 52 00
|..B.O.O.T.M.G.R.|

00000210
04 00 24 00 49 00 33 00
30 00 00 d4 00 00 00 24
|..$.I.3.0......$|

00000220
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
|................|

*

00000250
00 00 00 00 00 00 e9 c0
00 90 05 00 4e 00 54 00
|............N.T.|

00000260
4c 00 44 00 52 00 07 00
42 00 4f 00 4f 00 54 00
|L.D.R...B.O.O.T.|

00000270
54 00 47 00 54 00 07 00
42 00 4f 00 4f 00 54 00
|T.G.T...B.O.O.T.|

00000280
4e 00 58 00 54 00 00 00
00 00 00 00 00 00 00 00
|N.X.T...........|

00000290
00 00 00 00 00 00 00 00
00 00 0d 0a 41 6e 20 6f
|............An o|

000002a0
70 65 72 61 74 69 6e 67
20 73 79 73 74 65 6d 20
|perating system |

000002b0
77 61 73 6e 27 74 20 66
6f 75 6e 64 2e 20 54 72
|wasn't found. Tr|

000002c0
79 20 64 69 73 63 6f 6e
6e 65 63 74 69 6e 67 20
|y disconnecting |

000002d0
61 6e 79 20 64 72 69 76
65 73 20 74 68 61 74 20
|any drives that |

000002e0
64 6f 6e 27 74 0d 0a 63
6f 6e 74 61 69 6e 20 61
|don't..contain a|

000002f0
6e 20 6f 70 65 72 61 74
69 6e 67 20 73 79 73 74
|n operating syst|

00000300
65 6d 2e 00 00 00 00 00
00 00 00 00 00 00 00 00
|em..............|

00000310
00 00 00 00 00 00 00 9a
02 66 0f b7 06 0b 00 66
|.........f.....f|

00000320
0f b6 1e 0d 00 66 f7 e3
66 a3 52 02 66 8b 0e 40
|.....f..f.R.f..@|

00000330
00 80 f9 00 0f 8f 0e 00
f6 d9 66 b8 01 00 00 00
|..........f.....|

00000340
66 d3 e0 eb 08 90 66 a1
52 02 66 f7 e1 66 a3 86
|f.....f.R.f..f..|

00000350
02 66 0f b7 1e 0b 00 66
33 d2 66 f7 f3 66 a3 56
|.f.....f3.f..f.V|

00000360
02 e8 a2 04 66 8b 0e 4e
02 66 89 0e 26 02 66 03
|....f..N.f..&.f.|

00000370
0e 86 02 66 89 0e 2a 02
66 03 0e 86 02 66 89 0e
|...f..*.f....f..|

00000380
2e 02 66 03 0e 86 02 66
89 0e 3e 02 66 03 0e 86
|..f....f..>.f...|

00000390
02 66 89 0e 46 02 66 b8
90 00 00 00 66 8b 0e 26
|.f..F.f.....f..&|

000003a0
02 e8 90 09 66 0b c0 0f
84 bf fd 66 a3 32 02 66
|....f......f.2.f|

000003b0
b8 a0 00 00 00 66 8b 0e
2a 02 e8 77 09 66 a3 36
|.....f..*..w.f.6|

000003c0
02 66 b8 b0 00 00 00 66
8b 0e 2e 02 e8 65 09 66
|.f.....f.....e.f|

000003d0
a3 3a 02 66 a1 32 02 66
0b c0 0f 84 8c fd 67 80
|.:.f.2.f......g.|

000003e0
78 08 00 0f 85 83 fd 67
66 8d 50 10 67 03 42 04
|x......gf.P.g.B.|

000003f0
67 66 0f b6 48 0c 66 89
0e 92 02 67 66 8b 48 08
|gf..H.f....gf.H.|

00000400

Mar 10, 2018 4:49 AM in response to Loner T

I haven't been able to expand the partition, gparted showed a few errors ("cluster <some number> is referenced multiple times") and wouldn't let me expand the Windows partition.


All gparted did was delete the Unknown partition so now I have some 35GB of unallocated space. Due to this the Windows partition no longer appears on the bootcamp startup menu.


diskutil list:


/dev/disk0 (internal, physical):

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *240.1 GB
disk0

1: EFI EFI 209.7 MB
disk0s1

2: Apple_APFS Container disk1 90.7 GB disk0s2

3: Microsoft Basic Data BOOTCAMP 115.0 GB
disk0s4


/dev/disk1 (synthesized):

#: TYPE NAME SIZE IDENTIFIER

0: APFS Container Scheme - +90.7 GB disk1

Physical Store disk0s2

1: APFS Volume Macintosh HD 64.0 GB disk1s1

2: APFS Volume Preboot 19.7 MB disk1s2

3: APFS Volume Recovery 507.2 MB
disk1s3

4: APFS Volume VM 4.3 GB disk1s4



sudo gpt -vv -r show /dev/disk0:


gpt show: /dev/disk0: mediasize=240057409536; sectorsize=512; blocks=468862128

gpt show: /dev/disk0: PMBR at sector 0

gpt show: /dev/disk0: Pri GPT at sector 1

gpt show: /dev/disk0: Sec GPT at sector 468862127

start size
index
contents

0 1 PMBR

1 1 Pri GPT header

2 32 Pri GPT table

34 6

40 409600 1
GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640
177050784 2
GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC


177460424
66796344


244256768
224605327 4
GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7


468862095 32 Sec GPT table


468862127 1 Sec GPT header

Mar 10, 2018 6:42 AM in response to Loner T

OK, managed to run chkdsk and repaired the errors. GParted has been run now too so I've successfully expanded the Windows partition.


Only issue now is that the Windows partition isn't appearing as a bootable partition when I start the Mac with the option key being held down. How do I do that? Thanks


diskutil list

/dev/disk0 (internal, physical):

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *240.1 GB
disk0

1: EFI EFI 209.7 MB
disk0s1

2: Apple_APFS Container disk1 90.7 GB disk0s2

3: Microsoft Basic Data BOOTCAMP 149.2 GB
disk0s4


/dev/disk1 (synthesized):

#: TYPE NAME SIZE IDENTIFIER

0: APFS Container Scheme - +90.7 GB disk1

Physical Store disk0s2

1: APFS Volume Macintosh HD 64.0 GB disk1s1

2: APFS Volume Preboot 19.7 MB disk1s2

3: APFS Volume Recovery 507.2 MB
disk1s3

4: APFS Volume VM 4.3 GB disk1s4


sudo gpt -vv -r show /dev/disk0

gpt show: /dev/disk0: mediasize=240057409536; sectorsize=512; blocks=468862128

gpt show: /dev/disk0: PMBR at sector 0

gpt show: /dev/disk0: Pri GPT at sector 1

gpt show: /dev/disk0: Sec GPT at sector 468862127

start size
index
contents

0 1 PMBR

1 1 Pri GPT header

2 32 Pri GPT table

34 6

40 409600 1
GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640
177050784 2
GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC


177460424 824


177461248
291399680 4
GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7


468860928 1167


468862095 32 Sec GPT table


468862127 1 Sec GPT header

Mar 10, 2018 7:33 AM in response to SebPinski

SebPinski wrote:




sudo gpt -vv -r show /dev/disk0

gpt show: /dev/disk0: mediasize=240057409536; sectorsize=512; blocks=468862128

gpt show: /dev/disk0: PMBR at sector 0

gpt show: /dev/disk0: Pri GPT at sector 1

gpt show: /dev/disk0: Sec GPT at sector 468862127

start size
index
contents

0 1 PMBR

1 1 Pri GPT header

2 32 Pri GPT table

34 6

40 409600 1
GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640
177050784 2
GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC


177460424 824


177461248
291399680 4
GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7


468860928 1167


468862095 32 Sec GPT table


468862127 1 Sec GPT header

Notice that you do not have a GPT3. I suggest we correct this first, and then create the MBR. This will avoid future issues. Do you know how to delete/recreate GPT entries the gpt add/remove commands?

Mar 12, 2018 3:32 PM in response to Loner T

No, I haven't got that far, I got to step 9, then got propted to answer this:

"Unused partition space(s) found. Use one to protect more partitions? (Y/N)"


I responded 'N', and expected to do these steps:

10. O (print current Hybrid MBR)

11. W (Write the new MBR)

12. Y (Yes! write the new MBR)

13. Reboot


But straight after responding with 'N' to the unused partition question it asked:

"Recovery/transformation command (? for help):"


Is it this question that I answer "O" (step 10?)

Returning Partition Table

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.