Cannot resize APFS container even though there is a free space directly after it – diskutil error: -69743

apfsdisk-utilitypartition

I upgraded to a larger SSD (120 GB to 250 GB), and copied my existing mac SSD to a larger one with dd (clonezilla live usb). It is a hackintosh with a latest OpenCore 0.5.9.

However, I cannot resize the APFS container into a newly available free space:

❯ diskutil apfs resizeContainer disk0s2 0

Started APFS operation
Error: -69743: The new size must be different than the existing size

Here is a disk layout showing a lot of free space after second GPT partition:

❯ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk3         119.8 GB   disk0s2
❯ sudo gpt -r show disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  234031968      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  234441608  253955527
  488397135         32         Sec GPT table
  488397167          1         Sec GPT header

Here's how the attempt to resize partition ends up in Disk Utility:

The disk is 250 GB

enter image description here

APFS container is 120 GB

enter image description here

Disk utility shows APFS container and free space properly …

enter image description here

enter image description here

… so I delete the free space …

enter image description here

… confirm …

enter image description here

… and end up in a same place.

enter image description here

Any idea what to do?

Best Answer

Apparently a partition map needed repairing. It is worth noting, that this worked, while running First Aid from Disk Utility didn't help.

sudo diskutil repairdisk disk0

It warned about possibly destroying an EFI partition, so I backed up its contents:

Repairing the partition map might erase disk0s1, proceed? (y/N) y
Started partition map repair on disk0
Checking prerequisites
Checking the partition list
Adjusting partition map to fit whole disk as required
Checking for an EFI system partition
Checking the EFI system partition's size
Checking the EFI system partition's file system
Checking the EFI system partition's folder content
Checking all HFS data partition loader spaces
Checking booter partitions
Reviewing boot support loaders
Checking Core Storage Physical Volume partitions
The partition map appears to be OK
Finished partition map repair on disk0

... but the EFI partition survived, and then the resize worked:

diskutil apfs resizeContainer disk0s2 0