1

I used to have a bootcamp partition but somehow while attempting to remove it its changed into a container disk. (don't know how this happened, I didn't explicitly create a container).

enter image description here

enter image description here

diskutil list:

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         402.0 GB   disk0s2
   3:                 Apple_APFS Container disk2         97.8 GB    disk0s3
   4:                 Apple_Boot Boot OS X               134.2 MB   disk0s4

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +402.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            336.1 GB   disk1s1
   2:                APFS Volume Preboot                 23.2 MB    disk1s2
   3:                APFS Volume Recovery                515.0 MB   disk1s3
   4:                APFS Volume VM                      2.1 GB     disk1s4

/dev/disk2 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +97.8 GB    disk2
                                 Physical Store disk0s3

How can I delete this and merge its space back into the main drive?

2

Here, I assume the macOS volume that you boot to is Macintosh HD.

The commands below should remove the extra partitions and return the free space back to macOS.

 diskutil erasevolume free none disk0s4 
 diskutil apfs deletecontainer disk0s3
 diskutil erasevolume free none disk0s3
 diskutil apfs resizecontainer disk0s2 0

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.