2

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

7
  • 1
    I don't know enough about APFS yet to fix this, but a Container is not a partition, it is, as the name suggests, a container, which can hold several automatically resizable APFS Volumes. Partitions do not go inside containers, the container 'moves aside' if you create HFS or FAT partitions. So, rather than throwing out that old coat in the wardrobe, you threw out the wardrobe & all inside it. See support.apple.com/en-ae/guide/disk-utility/… & howtogeek.com/327328/…
    – Tetsujin
    Jan 4 '18 at 7:44
  • @Tetsujin: The first command replaces the container with an empty JHFS+ volume. The partition size and location does not change. The second command actually deletes the partition. The third command should have added the free space to the remaining container. The problem here is that you are not allowed to have two containers in the first place. Most of the commands will not allow the creation of a second container. Instead you get an error message. BUT, I know of at least one command that will incorrectly allow the creation of a second container. Apple has APFS bugs that need fixing. Jan 4 '18 at 10:59
  • @Dave: Post the output from the Terminal application commands diskutil list and diskutil apfs list. Jan 4 '18 at 11:22
  • @DavidAnderson What does the sentence "The problem here is that you are not allowed to have two containers in the first place" mean here?
    – klanomath
    Jan 5 '18 at 1:27
  • @Tetsujin I would say the opposite: The container consists at least of one partition and a later step in the evolution of APFS is to "move several partitions into one container" (similar to CoreStorage). The equivalent of a "disk partition" is the "APFS physical store disk". In the current implementation of APFS one partition(=physical store disk) is one container. One container/partition may contain several volumes though which is wasn't possible with the old scheme (1 partition = 1 volume (= a partition with a file system)).
    – klanomath
    Jan 5 '18 at 1:53
1

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.

1
  • Yes, I got it from the posted question: MacOS High Sierra: how can I merge 2 partitions into one?. I had the same problem but unfortunately it didn't work that way for me.
    – Dave
    Jan 5 '18 at 0:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .