This is on a Macbook Pro with a 250 GB disk that was originally split into two partitions, roughly 90 (Macintosh HD) and 160 GB (disk2). The machine is now on Catalina with the first partition being APFS and the second staying HFS. There is not enough space on the first partition and I am trying to add more space from the second to the first by following this guide: https://www.macobserver.com/tips/deep-dive/resize-your-apfs-container/
After splitting the second partition into 2 with Disk Utility, I have an empty partition of 20GB that I convert to empty space by doing
sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0sX
as shown in the guide (on my system X is 5, not 3 as in the guide but this should not make any difference). Then when I try to resize the APFS container as shown in the guide by doing
diskutil apfs resizeContainer disk0s2 0
it gives me
Started APFS operation. Error: -69519: The target disk is too small for this operation, or a gap is required in your partition map which is missing or too small, which is often caused by an attempt to grow a partition beyond the beginning of another partition or beyond the end of partition map usable space
disk0s2 seems to be the correct disk as shown in
... 2: Apple_APFS Container disk1 89.5 GB disk0s2 ...
Any ideas whether what I am trying to achieve is even possible and if it is, how to do it?
Conclusion: I went with the second suggestion by David Anderson and it seems fine. The only thing that I noticed is that the high-level folders in disk2 are owned by root after copying them back, but that doesn't seem to be an issue.
As always, make sure that you have reliable backup of your system before doing this