Unable to Expand APFS Container [closed]

I'm having a problem similar to this one, where I can't expand an APFS container to fill all available space. Here's my disk layout in Catalina:

% sudo diskutil list                                        
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         1000.0 GB  disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +249.8 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD - Data     68.8 GB    disk1s1
   2:                APFS Volume Preboot                 165.8 MB   disk1s2
   3:                APFS Volume Recovery                528.5 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4
   5:                APFS Volume Macintosh HD            11.1 GB    disk1s5

I had used dd on a Linux machine to copy the files from a 250GB SSD to this new 1TB one. I should probably add this is for a Hackintosh, so I was eager to preserve the EFI partition. The command I used, and the output:

% sudo diskutil apfs resizeContainer /dev/disk1 0  
Password:
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

In the linked example, there was an additional container at the end of /dev/disk0, but that's not the case here. I'm hoping there's a command I can run to make this work!


Solution 1:

What I will try:

  1. decrease the container space to 200 GB for example:

    diskutil ap resizecontainer disk1 200g jhfs+ tokill 0b

  2. give the result of command :

    diskutil list

  3. if you have a 800g jhfs partition "tokill" you can do :

    diskutil erasevolume free space disk0s3

  4. then retry

    diskutil ap resizecontainer disk1 0b

If that doesn't work, the solution would be to clone (Carbon Copy Cloner) your system on an external disk, then reformat the internal disk and after booting from the external clone it to the internal disk.