Merging Mac HD with former Bootcamp partition

Discussion in 'macOS High Sierra (10.13)' started by Fu-Manchu, Mar 9, 2018.

  1. Fu-Manchu macrumors newbie

    Joined:
    Jun 4, 2014
    #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!

    [​IMG]
     
  2. organicCPU macrumors 6502a

    organicCPU

    Joined:
    Aug 8, 2016
    #2
    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.
     
  3. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #3
    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!
     
  4. organicCPU macrumors 6502a

    organicCPU

    Joined:
    Aug 8, 2016
    #4
    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.
     
  5. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #5
    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?
     
  6. organicCPU macrumors 6502a

    organicCPU

    Joined:
    Aug 8, 2016
    #6
  7. dsemf macrumors 6502

    Joined:
    Jul 26, 2014
    #7
    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
     
  8. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #8
    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?
     
  9. Mike Boreham macrumors 68000

    Joined:
    Aug 10, 2006
    Location:
    UK
    #9
    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:
     
  10. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #10
    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?
     
  11. organicCPU macrumors 6502a

    organicCPU

    Joined:
    Aug 8, 2016
    #11
    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.
     
  12. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #12
    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?
     
  13. organicCPU, Mar 10, 2018
    Last edited: Mar 10, 2018

    organicCPU macrumors 6502a

    organicCPU

    Joined:
    Aug 8, 2016
    #13
    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
     
  14. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #14
    what does that mean, if the whole drive is APFS? I attached two screenshots, the apfs list and the basic diskutil list

    [​IMG]

    [​IMG]
     
  15. organicCPU, Mar 10, 2018
    Last edited: Mar 10, 2018

    organicCPU macrumors 6502a

    organicCPU

    Joined:
    Aug 8, 2016
    #15
    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?
     
  16. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #16
    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?
     
  17. organicCPU, Mar 10, 2018
    Last edited: Mar 10, 2018

    organicCPU macrumors 6502a

    organicCPU

    Joined:
    Aug 8, 2016
    #17
    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.
     
  18. Fu-Manchu thread starter macrumors newbie

    Joined:
    Jun 4, 2014
    #18
    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!
     
  19. BLUEDOG314 macrumors 6502

    BLUEDOG314

    Joined:
    Dec 12, 2015
    #19
    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.
     
  20. Mike Boreham macrumors 68000

    Joined:
    Aug 10, 2006
    Location:
    UK
    #20
    Thanks for the info. Will that work with an APFS drive?
     
  21. BLUEDOG314 macrumors 6502

    BLUEDOG314

    Joined:
    Dec 12, 2015
    #21
    Yep, you can give the space back to the APFS container, which is then shared by all the partitions within.
     
  22. Mike Boreham macrumors 68000

    Joined:
    Aug 10, 2006
    Location:
    UK
    #22
    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.
     

Share This Page

21 March 9, 2018