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

Photo of author
Stealth

I have seen that most of the time the answer to the questions ”How can I merge primary APFS partition with other empty APFS partition?"Or"How do we delete bootcamp partition and add the volume of an existing APFS container?"It is the reinstallation of all the macos with the formatting of the HDD.
Well, there are other simpler solutions that do not require a system reinstallation that could last several hours with personalized applications and settings.

If you used Boot Camp Assistant To install a parallel operating system (Windows7, Windows 10, etc.), a new partition called Bootcamp appeared. This partition most often holds the parallel operating system, being created during the installation process in the primary partition space. Master. If you want to give up the parallel operating system installed on Macbook and you want the space occupied by the "bootcamp" part to be erased and added to the macos partition, then you have to follow a simple tutorial that will take up much less than to Reinstal the entire maccos operating system.

How can we delete a paritis and how to add the space left free to a partition APFS - Resize APFS Container

In our scenario we have to deal with a hard drive 250 GB divided into a partition (container) APFS the main 199 GB (Apple_APFS Container disk1disk0s2) and one that I had Bootcamp of 50.7 GB (Apple_HFS Untitled – disk0s3) What is to be erased, and its 50.7 GB space is added to the main partition. In the end we will get a single 250GB partition.

1. We delete the volume Disk0S3 without forming it. In this way we will get a free space on disk that we can subsequently add to disk0s2.

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

2. We allocate the main APFS partition to the space left free on the disk after the above operation.

diskutil apfs resizeContainer disk0s2 0

At the end we will get a single "maccos" partition / disk0s2 of 250 GB.

In the situation where you have more partitions you have to be very careful what you delete. Identify the name of the partition you want to delete correctly, then execute the control line. To view all available parts and volumes, executed in Terminal command: Discutil List.

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

I've been writing passionately since 2004 about Windows and Linux operating systems, and since 2010 I've become a fan of Apple University. I'm currently writing tutorials for Mac, iPhone, iPad, Apple Watch, AirPods, and other Apple devices.

11 thoughts on “Merge APFS Containers in single partition / macOS High Sierra or Mojave"

  1. I tried what you suggested your port, but can’t seem to get it done. My Mac has 3 main partitions (drives I can see mounted in 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 biggest, 2.9 TB vs 200 GB of Mojave.

    diskutier list gives me lots of partitions and to make things worst, each partition (Mojave and Sierra) have recovery mode partitions and I can’t get rid of the one in Sierra either.

    After using diskutil list in terminal this is what I get:

    Last login: Mon Oct 15 11:18:13 on console
    iMac-de -imac5k: ~ iMac5k $ discussion letter
    /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 Container disk2 121.1 GB disk0s2

    /dev/disk1 (internal, physical):
    #: TYPE NAME SIZE IDENTIFIER
    0: GUID_partition_scheme *3.0 TB disk1
    1: Efi Efi
    2: Apple_APFS Container disk2 2.7 TB disk1s2
    3: Apple_APFS Container disk3 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…

    Reply
  2. Hello, I tried to do what you suggested but could not relocate the space released in the main partition.

    My disc 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 Container disk1 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

    I removed the Disk0s2 and Disk0s3 volumes:

    sudo diskutil eraseVolume “Free Space” %noformat% /dev/disk0s2
    sudo diskutil eraseVolume “Free Space” %noformat% /dev/disk0s3

    And my record was as follows:

    Discutil 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 Container disk1 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

    But when executing the command: Diskutil Apps Resizecontainer Disk0s4 0, I 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 of the records I have erased, nor can this free space allocate in my main partition. Do you know how I can solve?

    Reply
  3. Finally a clear and effective explanation. There are lots of things on the internet but unusable and confusing container, partition, volume etc. THANK YOU !

    Reply
Leave a Comment