Change Partition size on internal AFPS drive A month or so ago, I added a new partition to my 500 GB SSD drive so I could have MacOS Mojave on a separate partition. After adding the new partition, I was left with two logical volumes that were 450GB and 50GB.

Fast forward to this evening. I went to update for the latest release and I needed more space. I added an unnamed partition and reduced the size of my 450GB partition to 400GB and I'm left with 3 logical partitions. I was thinking I'd resize the empty 50GB partition to zero and up the other 50GB partition to 100GB and I'd be on my merry way...I thought wrong. 

I took a look at this article from MacWorld, but it seems to be written to address a scenario for an external drive, not an internal drive.

When I'm done, I'd like to have Macintosh HD sized to 400GB and Mojave beta sized to 100GB.

Here are my questions:

1) How do I nuke an empty partition?

2) How do I resize the Mojave beta partition from 50GB to 100GB?



UPDATE

Progress. I selected the Apple SSD, clicked partition, highlighted the empty partition, and clicked "-", which removed it. I still can't resize the other two partitions. Ideas are greatly appreciated.
Ok, so it turns out this error -5344: MediaKit reports not enough space on device for requested operation is caused by the fact that you are trying to expand a container backward into free space that exists before it on the partition list, even though Disk Utility (and by extension diskutil) can only expand partitions forward into free space that comes after the container in the partition list. Another notable error is your attempt to resize the Physical Store partitions on which the Container disks are stored (disk0s2 and disk0s4), rather than the Container disks themselves (disk3, disk4, and disk5 in the below example). 

With a bit of trial and error I was able to figure out how to effectively merge Containers 2 and 3 into one, with no data loss to Container 1. Note that this will require the deleting of the Mojave beta partition, so make sure you either have it backed up, or have an installer on hand. 

UPDATE: There is a way to do this without having to reinstall the second OS. In macOS versions up to Sierra (I haven't tried it in newer) you could create directly bootable backups of your entire system with (adjusting for the disk names you gave in your question) sudo ditto -V -X --nocache /Volumes/Mojave\ beta/ /Volumes/Untitled/ NOTE: for backing up the currently booted system, subsitute /Volumes/Mojave\ beta/ with /

For posterity please make sure you have a macOS installer (USB or Recovery HD) on hand for each OS you have installed. 

Please also remember that these disk lables are just the ones for my disk on my system, always double check the names are correct for yours when running these commands by comparing them with the output of diskutil apfs list 

In order to replicate your situation the best I could, using Disk Utility I formatted a 4 GB flash drive as APFS. I then partitioned the disk two separate times, which resulted in three APFS Containers, and three virtual volumes, in the following order:


  First Container
  Container disk3  -  1.85G
  Physical Store disk2s2
  Volume disk3s1  
  
  Second Container
  Container disk4  -  0.94G
  Physical Store disk2s3
  Volume disk4s1  
  
  Third Container
  Container disk5  -  0.94G
  Physical Store disk2s4
  Volume disk5s1


I then opened a terminal, and deleted the Third Container with: diskutil apfs deleteContainer disk5, which resulted in disk2s4 being converted into an HFS+ volume.  

After this I deleted the partition disk2s4, and in so doing freed up the space necessary to expand the Second Container by running diskutil eraseVolume "Free Space" "" disk2s4  

At this point the partition list looked like this:  


  First Container
  Container disk3  -  1.85G
  Physical Store disk2s2
  Volume disk3s1  
  
  Second Container
  Container disk4  -  0.94G
  Physical Store disk2s3
  Volume disk4s1  
  
  Free Space  -  0.94G  


Finally I was able to expand the Second Container to 1.85 GB with diskutil apfs resizeContainer disk4 1.85G. The final result of this is two APFS Container disks of equal value on the flash drive:  


  First Container
  Container disk3  -  1.85G
  Physical Store disk2s2
  Volume disk3s1  
  
  Second Container
  Container disk4  -  1.85G
  Physical Store disk2s3
  Volume disk4s1  


Besides adjusting the commands so that the disk labels match those on your own machine, the one notable substitution you should make is changing 1.85G to 100G in the final command. Beyond that this should be all you need to make the conversion requested.