Macbook Pro 2018 13 inch Partition Won’t Delete

bootcampdisk-utilityhard drivepartition

When I tried to bootcamp today and it failed midway through and wouldn't delete the partition. I've tried deleting the partition manually through disk utility both through the regular desktop and recovery mode. I was unable to delete this partition made by the bootcamp utility and trying to use bootcamp utility to delete yields no results.

This is why my disk utility looks like. Macintosh HD is my main partition that I wish to keep and Container disk1 is the partition that was originally made by bootcamp and that I tried to manually erase but it does not go away.enter image description here

Attempting to do diskutil list yields:

   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk2         197.0 GB   disk0s2
   3:                 Apple_APFS Container disk1         53.6 GB    disk0s3
   4:                 Apple_Boot Boot OS X               134.2 MB   disk0s4

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +53.6 GB    disk1
                                 Physical Store disk0s3
   1:                APFS Volume Preboot                 45.1 MB    disk1s2
   2:                APFS Volume Recovery                20.5 KB    disk1s3

/dev/disk2 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +197.0 GB   disk2
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            165.7 GB   disk2s1
   2:                APFS Volume Preboot                 45.2 MB    disk2s2
   3:                APFS Volume Recovery                510.5 MB   disk2s3
   4:                APFS Volume VM                      2.1 GB     disk2s4

Doing diskutil cs list yields "No CoreStorage logical volume groups found"

Please help, I am lost and unsure what to do.

Best Answer

I suppose your System is High Sierra or Mojave. I'm amazed that Boot Camp Assistant created a container during its installation. Otherwise, to remove this container, the terminal command is:

diskutil ap deletecontainer disk1 

Then to free disk space :

diskutil erasevolume free space disk0s3

and finally add this space to your system container :

diskutil ap resizecontainer disk2 0b

After these operations, give the result of :

diskutil list

There is a partition that seems useless to me:

4: Apple_Boot Boot OS X 134.2 MB disk0s4

Before removing it, are you using Filevault (data encryption)?

Edit : Filevault don't need this partition type. I've try on a Virtual Machine.

You can delete this partition :

diskutil erasevolume free space disk0s4 

Then add this space to your system container :

diskutil ap resizecontainer disk2 0b