8

So i've battled with this for quite some time, look up various topics with various solutions, however i have yet to succeed with merging my partitions into one. I had previously installed windows 10 on it, but after i partitioned for a mutual accessible drive (for dropbox), windows stalled and i had to reformat it, resulting in a sort of "locked" partition.

If i click on "Partition" in Disk Utility, there are two major partitions, where neither of them have the "-" option available(greyed out). I have tried to partition DeleteThis into both ExFat, Fat and Journaled OS X, with no difference.

diskutil list reveals this: Diskutil list

and gpt -r show -l /dev/disk0 shows this: enter image description here

I've also tried to reboot into recovery mode and use the Disk Utility there, with no different result than from normal.

EDIT: I have of course also tried using Boot Camp Assistant, but it just says "The start disk cannot be partitioned or restored as a single partition".

MmmHmm
  • 2,811
  • You need to delete the last 3 partitions. The easiest command to use is gpt. I believe you have to execute this command while booted to internet recovery. Are you familiar with using internet recovery? Also what is the model/year of your Mac? Older mac's can not use internet recovery. – David Anderson Apr 16 '16 at 07:27
  • Do i also need to delete the OSXRESERVED partition? If it's the reinstall options from recovery mode, then it says "Could not find installation information for this machine"...

    EDIT: Switched wifi, now i can access it. It shows me three different options: Macintosh HD(my current), OSXRESERVED and DeleteThis.

    – Benjamin Apr 16 '16 at 07:32
  • Just realised i was in local recovery(cmd+r) and not internet recovery(cmd+opt+r). Internet recovery is currently progressing as we speak. The model is 2016. – Benjamin Apr 16 '16 at 07:41
  • OSXRESERVED is created by the Boot Camp Assistant. The Windows iso file is copied there. That is how Apple manages to install Windows without a DVD or USB flash drive. Some partitions you need to delete are hidden and do not appear in the Disk Utility. – David Anderson Apr 16 '16 at 07:42
  • Ohh.. When i try to delete it from disk utility it says "The target Core Storage volume is locked" – Benjamin Apr 16 '16 at 07:48
  • When you enter diskutil list is disk0 and disk1 the same as shown in your above posted question? – David Anderson Apr 16 '16 at 07:52
  • No, if i enter it from the terminal window from recovery, it looks different. The we have 2 "partitions" at disk0(disk image), where OS X Base system is one of them. them disk1(internal, physical) has 6 "partitions", where 4 of them are the ones i want to merge together – Benjamin Apr 16 '16 at 07:59
  • I assume then that you want to remove the last three partitions on disk1. These are 8.0 GB, 16.8 MB and 149.9 GB in size. Afterwards you want to add this space back to your OS X partition (131.4 GB)? – David Anderson Apr 16 '16 at 08:08
  • Yes, i want to end up with 1 partition with 500gb as originally. I've managed to merge the three smaller partitions into one on the OSX Recovery partition, but when i try to merge it with my main partition it says "The target Core Storage volume is locked" – Benjamin Apr 16 '16 at 08:15
  • I image if I ask you to unmount disk1 using the commanddiskutil unmountDisk /dev/disk1`, this will fail. I believe you have to first unmount the disk that contains your OS X volume (Logical volume on disk1s2). – David Anderson Apr 16 '16 at 08:21
  • Actually no, it succesfully unmounts disk1 – Benjamin Apr 16 '16 at 08:23
  • You need to remove the partitions 4, 5 and 6 on disk1. My answer shows disk0, but you show disk1. If you do not have to unmount the virtual disk, then maybe Apple changed things so this is now done automatically. – David Anderson Apr 16 '16 at 08:34

3 Answers3

9

The answer is so simple. Forget terminals and internet recovery. Here's what you gotta do:

  1. Format the BOOTCAMP-partition through disk utility to MS-DOS (FAT)
  2. Press cmd + space and write bootcamp-assistant, open bootcamp
  3. Erase windows and merge the partitions as one mac HD-partition.
Charles
  • 91
8

Hold down the Command ⌘OptionR keys at startup to boot to OS X Internet Recovery. Once you have started your Mac in OS X Internet Recovery mode, you need to use the gpt command to remove the unneeded partitions. You can then expand your core storage partition to recovery the freed space back into your OS X partition.

To use the gpt command, you need to unmount your physical internal disk. If you are using core storage, then you have to unmount the virtual internal disk first. The commands are shown below. Note: Once booted to internet recovery, the disk numbers may change. The disk numbers used below are based the the values shown in your posted question. The partitions to be removed are 4, 5 and 6 on disk0.

To remove partition 6, enter the commands.

diskutil  unmountDisk  /dev/disk1
diskutil  unmountDisk  /dev/disk0
gpt  remove  -i  6  /dev/disk0

To delete the remaining partitions, repeat the commands.

diskutil  unmountDisk  /dev/disk1
diskutil  unmountDisk  /dev/disk0
gpt  remove  -i  5  /dev/disk0
diskutil  unmountDisk  /dev/disk1
diskutil  unmountDisk  /dev/disk0
gpt  remove  -i  4  /dev/disk0

Now, when executing the command

gpt  -r  show  /dev/disk0

the removed partitions should not appear. You can restart back to El Capitan.

Use the Disk Utility application to recover the freed space. Use the steps below.

  1. Highlight the internal disk.
  2. Click on the icon labeled "Partition".
  3. Highlight the free space shown in the pie chart. See example below.

    321

  4. Click on the "-" symbol. Your OS X partition should fill the pie chart. See example below.

    322

  5. Click on the "Apply" button.
  • So i managed to remove the OSX Reserved partition, so it's gone now. Now how do i find it again? – Benjamin Apr 16 '16 at 08:45
  • The gpt remove command sets the partition type id to 00000000-0000-0000-0000-000000000000. This partition will no longer appear when using diskutil list or gpt show commands. The partition information is still in the gpt and the contents of the removed partition is unchanged on your internal disk. I assume you no longer what the data stored on the removed partition. You are freeing the space to later be reclaimed. – David Anderson Apr 16 '16 at 09:03
  • I ran the repair tool and it is now appearing again as free available space, able to merge. Thanks for your help! – Benjamin Apr 16 '16 at 09:03
  • Awesome, this is the only way I could retrieve the windows partition after Bootcamp failed to do it. Lesson of the day: never EVER put Windows on your beautiful Mac – Guillaume Jan 19 '17 at 14:26
  • Thanks, it helps me. Don't forget to get the correct partition number before deleting. – Dody Rachmat Wicaksono Dec 13 '17 at 12:08
1

You can not use DiskUtility on a Bootcamp partition, whatever you want to do. Only use BootcampAssistant when you want to change or delete the Bootcamp partition.

LexS
  • 1,451