MacOS Mojave: Tried to merge disk partition into primary one and now 20 GB of space is “lost”

disk-utilityhard drivepartition

SOLVED: My issue is solved. I used recovery mode to erase entire drive and create new APFS disk which was created with correct size. I then used my last Time Machine backup to restore the system. Thanks everyone.


So I got used Macbook Pro 2017 some days ago and it had its 128 GB SSD split into two disk containers each with its own disk. One disk is the main one and it has around 100 GB and the second one contained the remaining space.

I wanted to merge them. After trying unsuccessfuly with the Disk Utility app, I resorted to Terminal and found this answer to do it – https://apple.stackexchange.com/a/310665/256353 Of course I changed the disk identifiers…

However in the last step I got error:

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

And now the 20 GB of space is just lost. I cannot see it anywhere. How do I get it back and merge to the main partition?

Below are Disk Utility screenshots

enter image description here

enter image description here

EDIT: I tried Disk Utility in Recovery Mode, but it did not help. I still cannot see the lost 20 GB. I also tried recreating second Container Disk to "undo" my previous changes but got error that there is no "disk" for it.

EDIT 2: Here is the screenshot when I want to partition my drive. 20 GBs is still missing.

enter image description here

EDIT 3: Added more diskutil output

diskutil list disk0

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         121.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         98.9 GB    disk0s2

diskutil info disk0s1

   Device Identifier:         disk0s1
   Device Node:               /dev/disk0s1
   Whole:                     No
   Part of Whole:             disk0

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Partition Type:            EFI
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  PCI-Express
   SMART Status:              Not Supported
   Volume UUID:               E783267B-A4C3-3556-B751-DBED770EB996
   Disk / Partition UUID:     753A45C0-573F-458B-B5AE-EFEC09981DDF
   Partition Offset:          24576 Bytes (6 4096-Byte-Device-Blocks)

   Disk Size:                 314.6 MB (314572800 Bytes) (exactly 614400 512-Byte-Units)
   Device Block Size:         4096 Bytes

   Read-Only Media:           No
   Read-Only Volume:          Not applicable (no file system)

   Device Location:           Internal
   Removable Media:           Fixed

   Solid State:               Yes
   Hardware AES Support:      No

diskutil info disk0s2

Device Identifier:         disk0s2
   Device Node:               /dev/disk0s2
   Whole:                     No
   Part of Whole:             disk0

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Partition Type:            Apple_APFS
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  PCI-Express
   SMART Status:              Not Supported
   Disk / Partition UUID:     4BF4FEBA-0970-4F39-9177-0B3403D83921
   Partition Offset:          22403522560 Bytes (5469610 4096-Byte-Device-Blocks)

   Disk Size:                 98.9 GB (98929283072 Bytes) (exactly 193221256 512-Byte-Units)
   Device Block Size:         4096 Bytes

   Read-Only Media:           No
   Read-Only Volume:          Not applicable (no file system)

   Device Location:           Internal
   Removable Media:           Fixed

   Solid State:               Yes
   Hardware AES Support:      No

diskutil info disk0s3

Could not find disk: disk0s3

Best Answer

Based on that you are currently having a broken disk, I would strongly recommend stopping trying to mess more around and instead bite the bullet and reinstall MacOS completely. After booting the installation media/recovery partition, start Disk Utility and use it to erase the drive completely, possibly even write a new partition layout and then install telling MacOS to use the whole drive.

If you have anything on it you want to keep, create a backup first (note 1). Time Machine is an obvious candidate as you can either get your home directory back, or you can tell the installer to restore your computer as it was. I did this a lot on my previous Mac after upgrading the harddrive. If you encrypt your backup, you get your passwords back too.

Note 1: I have been burned enough to never fiddle with disk partitions and file systems on machines without proper backup. You can literally lose everything in seconds. Messing with terminal commands is tempting fate :)