Merge APFS Containers into 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 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 total reinstallation of macOS with HDD formatting.
Well, there are other much simpler solutions that do not require a system reinstallation that could take several hours with applications and customized settings.

If you have used it Boot Camp Assistant to install a parallel operating system (Windows7, Windows 10, etc.), on macOS a new partition called BOOTCAMP appeared. This partition most often holds the parallel operating system, it being created during the installation process from the space of the primary partition. Masters. If you want to give up the parallel operating system installed on Mac, MacBook and you want the space occupied by the "BOOTCAMP" partition to be deleted and added to the partition macOS, then you have a simple tutorial to follow that will take much less time than to reinstall the entire operating system macOS.

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 (Apple_APFS Container 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

In the end we will get a single partition "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 Port command: disktil list.

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

I am happy to share my experiences in the field of computers, mobile phones and operating systems, to develop web projects and to bring the most useful tutorials and advice. I like to "play" on the iPhone, MacBook Pro, iPad, AirPort Extreme and on operating systems macOS, iOS, Android and Windows.

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 the disk list in the terminal this is what I get:

    Last login: Mon Oct 15 11: 18: 13 on console
    iMac-of-iMac5K:~ imac5k $ discussion 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 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 209.7 MB disk1s1
    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-of-iMac5K:~ imac$ 5k

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

    Reply
  2. 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 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

    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 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

    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?

    Reply
  3. Finally, a clear and effective explanation. On trouve plein de choses sur internet mais unutilisables et confondant container, partition, volume etc. THANK YOU!

    Reply
Leave a Comment