Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fu-Manchu

macrumors newbie
Original poster
Jun 4, 2014
13
1
Hello,

I used to have a Bootcamp partition next to my Mac OS. Now I am selling my MBP (Retina 13" Late 2013), for which I wanted to delete the BC partition with the assistant. It said that I can't delete it which is why I deleted it throught he recovery/disk utility. I reinstalled Mac OS which worked fine but now I can't seem to merge the former BC partition with the "new" OS partition. It looks like in the attached screenshot.

Can anybody help me out? I just want to free up the 74,9GB and add it to the Mac OS partition. (It is also strange that the Mac OS seems to be installed on the "container disk1" and not directly under the SSD, right?)

Thanks!

59QONYR.jpg
 
If you don't mind reinstalling macOS one more time, repartition the whole drive again with just a single partition is probably the easiest solution. This should be possible if you either boot from an external drive or boot from a thumb drive installer and start Disk Utility from there. If Internet Recovery mode would work in this scenario I don't know. Containers are normal for more recent versions of macOS.
 
I wouldn't mind. But could you tell me how to set up the thumb drive to install it from there? And how would I go about merging the partitions from there? Thanks!
 
Mmh... Do you have backed up a macOS High Sierra installer app somewhere? If yes, you could grab Disk Maker X and make an installer on a 8 GB USB thumb drive. If you don't have a backup of a full size installer, you'd need an older running macOS to get the installer downloaded. If that's no option, cloning your current macOS to an external drive is probably the easier way. This could be done with a trial version of Carbon Copy Cloner or SuperDuper. Of course there are other ways to get the same results, but those are IMHO the most user friendly strategies.
Once you boot from an external drive and launch Disk Utility, you select APPLE SSD, select Partition from the Toolbar and set a single partition. That should erase the whole drive with all existing partitions. From there you can start over installing macOS or clone it back.
 
I guess I will have to clone it via one of those apps you mentioned, I will try that now. Do you have any idea why I screwed up the partitions this way?
 
Fu-Manchu,

Since you are cleaning this machine up for sale, would you be willing to try an experiment?

Here is a standard disk layout:

Code:
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.8 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.8 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            121.0 GB   disk1s1
   2:                APFS Volume Preboot                 26.2 MB    disk1s2
   3:                APFS Volume Recovery                509.8 MB   disk1s3
   4:                APFS Volume VM                      3.2 GB     disk1s4

APFS uses a container partition to hold volumes, which used to be partitions. The advantage is the each volume shares the container space. They can expand and shrink as needed. This simplifies space management.

In your case, you have two additional partitions because of Boot Camp. When boot camp is created, the container is shrunk to make room for the boot camp partitions. Now you want to make the boot camp space available for expanding the container.

Based on searches, I think the following will work:

Code:
sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0s3
sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0s4
diskutil apfs resizeContainer disk0s2 0

Disclaimer: I have not tested these commands so use at your own discretion.

DS
 
I tried the organicpu's solution, copied the os on an external drive, but I can't delete the ssd from there. it says something about the drive can't be opened. is there a workaround?

if I tried the suggestion by dsemf, what would the the risk be? could there be irreversible damage?
 
I tried the organicpu's solution, copied the os on an external drive, but I can't delete the ssd from there. it says something about the drive can't be opened. is there a workaround?

if I tried the suggestion by dsemf, what would the the risk be? could there be irreversible damage?

If you are trying to erase an APFS formatted drive with Disk Utility you need to delete APFS volume from the container before trying to erase the drive. The container needs to be empty.

Screen Shot 2018-03-10 at 07.42.06.png
See screenshot:
 
  • Like
Reactions: organicCPU
I see, thanks. so I boot from the external drive, delete the apfs volume and then format the whole ssd. after that boot into recovery mode and reinstall the OS on the formatted drive? could this screw anything up that can't be reversed?
 
could this screw anything up that can't be reversed?
You should try what @Mike Boreham suggests. If that doesn't work either, there are more options to try. Chances are very low that irreversible damages occur. Of course formatting a drive will wipe all data, but that's your intention.
 
but isn't the problem the former Windows partition and not the APFS partition? Apparently the problem was that I didn't delete the Windows partition from the BC assistant (cause the option was greyed) out, instead I formatted the Windows partition in disk utility, which cause this problem. Would it help to reinstall Windows on the BC partition and then try to remove it from the BC assistant?
 
I guess reinstalling Windows would overcomplicating things. Try to delete the Mac HD volume and then in the Partition menu, select one partition, klick the minus sign to get just a single partition and proceed.

EDIT: Your whole drive is APFS. To get a more comprehensive overview type into Terminal:
Code:
diskutil apfs list
 
Last edited:
what does that mean, if the whole drive is APFS? I attached two screenshots, the apfs list and the basic diskutil list

DRcj8L1.png


wXwGQvu.png
 
Your first screenshot shows that disk1 is your APFS container disk that has the physical base disk0s2.
That Physical Store Disk disk0s2 then has several following partitions:
disk1s1 is your boot partition containing macOS
disk1s2 is your preboot partition, AFAIK used for features related to security, e.g. the T2 chip in the new iMac Pro
disk1s3 is your recovery partition, that you boot if pressing Cmd + R
disk1s4 is for your virtual memory files (swapfiles)

In your second screenshot you can also find that disk0s2 (your physical base disk for APFS)
disk0 shows that your partition table is of type GUID Partition Table (GPT) using globally unique identifiers
disk0s1 keeps the EFI, the Extensible Firmware Interface, that has similar functions like BIOS, e.g. booting a specific OS on dual boot machines
disk0s2 see above
disk0s3 contains your Windows
disk0s4 is a HFS+ partition that I don't know why it's there, if it wasn't your intention to have a HFS partition, the former file system for macOS

disk2 is an external drive that seems to contain a Windows installer

disk3 is a disk image that is hooked into your file system

If you still feel, that there is something unusual going on, it's most likely related to disk0s4. Did you still get errors while trying to repartitioning?

EDIT: disk0s4 could contain an older version of macOS, e.g. El Capitan. If you restart and press Option during start, can you select to boot into a different macOS version?
 
Last edited:
it wasn't an older OS version, disk0s4 was the old bootcamp partition. I formatted it and named it Mac HD 2.

I assumed the method described by Mike won't work since you said the whole drive is APFS. Can I still proceed with trying to delete the container and then format the whole SSD from recovery?
 
Forget what I said about the whole drive being APFS. I guess I need to refresh my knowledge about the file system. However, the problem gets clearer. AFAIK, you can modify only the last partition of a drive, not those located in the middle. I think, deleting disk0s4 could solve your problems and return the system to normal behaviour.
 
Last edited:
I think it worked! I booted into internet recovery, deleted the APFS volume like Mike said and then formatted the whole SSD into one partition. Yay! Thanks a lot guys!
 
  • Like
Reactions: organicCPU
So obviously this is a resolved issue but I thought I would throw this in here. The easiest thing to do, which I have successfully done for your exact issue, would be to use mergepartitions verb in diskutil within terminal. I would probably also unmount the partitions that will be deleted first as they need to be.

Anyway, open terminal and enter 'diskutil mergepartitions' and hit enter. Since you are not actually giving it any partitions to merge, doing this will produce all the instructions and syntax on how to use the command.
 
So obviously this is a resolved issue but I thought I would throw this in here. The easiest thing to do, which I have successfully done for your exact issue, would be to use mergepartitions verb in diskutil within terminal. I would probably also unmount the partitions that will be deleted first as they need to be.

Anyway, open terminal and enter 'diskutil mergepartitions' and hit enter. Since you are not actually giving it any partitions to merge, doing this will produce all the instructions and syntax on how to use the command.

Thanks for the info. Will that work with an APFS drive?
 
Yep, you can give the space back to the APFS container, which is then shared by all the partitions within.
 
Yep, you can give the space back to the APFS container, which is then shared by all the partitions within.

Thanks. I was expecting it to be in diskutil apfs but there isn't a mergepartitions verb there. (I am not Terminal fluent but pick up and use stuff I find useful).

I thought that with an APFS volume having the option of being either a shared volume within the container or a separate partition (different container) this might be something different with APFS.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.