Curiosity MacOS tweaks

Merge APFS Containers in single partition / macOS High Sierra or Mojave

I have seen that most of the time the answer to the questions "How can I merge the primary APFS partition with another empty APFS partition?"Or"How do we delete the BOOTCAMP partition and add the volume of an existing APFS container?"Is the full reinstallation of macOS with HDD formatting.
Well, there are other, simpler solutions that do not require a system reset that could take several hours with custom applications and settings.

If you have used it Boot Camp Assistant to install a parallel operating system (Windows7, Windows 10, etc.), a new partition called BOOTCAMP appeared on MacOS. This partition often maintains the parallel operating system, which is created during the installation process from the primary partition space. Master. If you want to quit the parallel operating system installed on your Mac, MacBook and you want the space occupied by the BOOTCAMP partition to be deleted and added to the macOS partition, then you have to follow a simple tutorial that takes a lot less time than to reinstall the entire macOS operating system.

How to delete a parity and how to add free space to an APFS partition - Resize APFS Container

In our scenario we have to deal with a hard of 250 GB divided into a partition (container) APFS the main 199 GB (Container Apple_APFS disk1disk0s2) and one that we had BOOTCAMP by 50.7 GB (Apple_HFS Untitled - disk0s3) to be deleted and its 50.7 GB space added to the main partition. At the end we will get one 250GB partition.

1. We delete the disk0s3 volume without formatting it. In this way we will get one free space on the disk that we can later add to disk0s2.

sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0s3

2. We give the main APFS partition space left on the disk after the above operation.

diskutil apfs resizeContainer disk0s2 0

Finally, we get a single "macOS" / disk0s2 by 250 GB.

If you have multiple partitions you need to be very careful what you delete. Correctly identify the name of the partition you want to delete, then execute the command line. To view all available partitions and volumes, run in Terminal command: disktil list.

This tutorial is done on a beta version of a macOS Mojave, but it is compatible MacOS High Sierra.

Merge APFS Containers in single partition / macOS High Sierra or Mojave

About the author

stealth

I am pleased to share my experiences with computers, mobile telephony and operating systems, develop web projects and provide the most useful tutorials and tips.
I like to play on iPhone, MacBook Pro, iPad, AirPort Extreme and on MacOS, iOS, Android and Windows operating systems.

Leave a Comment

5 Comments

  • I tried what you suggested your port, but can not seem to get it done. My Mac has 3 main partitions (drives I can see mounted on the desktop). Mojave, High Sierra and Bootcamp. I want to keep Bootcamp as it is, but I want to merge the High Sierra one into the new Mojave partition. The old High Sierra partition is the largest, 2.9 TB vs 200 GB of Mojave.

    (Mojave and Sierra) have partition recovery mode and I can not get rid of the one in Sierra either.

    After using the disk list in the terminal this is what I get:

    Last login: Mon Oct 15 11: 18: 13 on console
    iMac-de-iMac5K: ~ imac5k $ disktil list
    / dev / disk0 (internal, physical):
    #: TYPE NAME SIZE IDENTIFIER
    0: GUID_partition_scheme * 121.3 GB disk0
    1: EFI EFI 209.7 MB disk0s1
    2: Apple_APFS Disk Container2 121.1 GB disk0s2

    / dev / disk1 (internal, physical):
    #: TYPE NAME SIZE IDENTIFIER
    0: GUID_partition_scheme * 3.0 TB disk1
    1: EFI EFI 209.7 MB disk1s1
    2: Apple_APFS Disk Container2 2.7 TB disk1s2
    3: Apple_APFS Disk Container3 199.4 GB disk1s3
    4: Microsoft Basic Data BootCamp 70.9 GB disk1s4

    / dev / disk2 (synthesized):
    #: TYPE NAME SIZE IDENTIFIER
    0: APFS Container Scheme - + 2.9 TB disk2
    Physical Stores disk0s2, disk1s2

    / dev / disk3 (synthesized):
    #: TYPE NAME SIZE IDENTIFIER
    0: APFS Container Scheme - + 199.4 GB disk3
    Physical Store disk1s3
    1: APFS Volume Macintosh HD 140.1 GB disk3s1
    2: APFS Volume Preboot 45.6 MB disk3s2
    3: APFS Volume Recovery 512.4 MB disk3s3
    4: APFS Volume VM 4.3 GB disk3s4

    iMac-de-iMac5K: ~ imac5k $

    Any advice ?, it's driving me crazy not knowing how to merge everything without a full reinstall / format ...

  • Hi, I tried to do what you suggested but failed to reallocate the free space in the main partition.

    My disk initially (diskutil list):

    / 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_HFS Untitled 939.5 MB disk0s2
    3: Apple_HFS Untitled 939.5 MB disk0s3
    4: Apple_APFS Disk Container1 248.6 GB disk0s4

    / dev / disk1 (synthesized):
    #: TYPE NAME SIZE IDENTIFIER
    0: APFS Container Scheme - + 248.6 GB disk1
    Physical Store disk0s4
    1: APFS Volume Macintosh HD 190.8 GB disk1s1
    2: APFS Volume Preboot 44.9 MB disk1s2
    3: APFS Volume Recovery 510.3 MB disk1s3
    4: APFS Volume VM 2.1 GB disk1s4

    Remove disk0s2 and disk0s3 volumes:

    sudo diskutil eraseVolume "Free Space"% noformat% / dev / disk0s2
    sudo diskutil eraseVolume "Free Space"% noformat% / dev / disk0s3

    And my disk went as follows:

    disktil list
    / 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 Disk Container1 248.6 GB disk0s4

    / dev / disk1 (synthesized):
    #: TYPE NAME SIZE IDENTIFIER
    0: APFS Container Scheme - + 248.6 GB disk1
    Physical Store disk0s4
    1: APFS Volume Macintosh HD 190.8 GB disk1s1
    2: APFS Volume Preboot 44.9 MB disk1s2
    3: APFS Volume Recovery 510.3 MB disk1s3
    4: APFS Volume VM 2.1 GB disk1s4

    We will execute the command: diskutil apfs resizeContainer disk0s4 0, you have the following error:

    Started APFS operation
    Error: -69743: The new size must be different than the existing size

    I can't find the (almost) 2gb that the discs I shut down, and I can't allocate that free space on my main partition. Do you know how I can solve it?