Disk Utility – Deleted Partition in High Sierra and Cannot See It

disk-utilitypartition

I deleted 1 of 2 partitions with the following commands to merge 2 partitions:

diskutil apfs deleteContainer disk0s3
diskutil eraseVolume free n disk0s3
diskutil apfs resizeContainer disk0s2 0

But I got the following error when I run the last command:

diskutil apfs resizeContainer disk0s2 0
Started APFS operation
Error: -69771: The target disk is too small for this operation

Now the partition which I deleted is not shown any more with Disk Utility. How do I get it back?

enter image description here

enter image description here

enter image description here

Best Answer

You received the error message because the Apple_KernalCoreDump partition resides immediately after the Apple_APFS partition. This I was able to verify.

I can not think of a reason to keep the Apple_KernalCoreDump partition. So, I would enter the commands given below to add the free space to the Apple_APFS partition.

diskutil  erasevolume  free  n  disk0s3
diskutil  apfs  resizeContainer  disk0s2  0

If after deletion, the Apple_KernalCoreDump partition reappears, then I would assume you drive is corrupted. In this case, I would backup important files, repartition the drive and reinstall macOS.