Resizing Mac OS partition - macOS High Sierra

Hi I am having issues trying to resize my Mac OS partition, I previously had a very large recovery partition almost 100gb as a result of removing my linux installation, I since resized this to 650mb. The problem is I am unsure on how to increase the size of my main Mac OS partition as I have no experience with this new container disk stuff.

Here is what diskutil list shows:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         150.4 GB   disk0s2
   3:                  Apple_HFS Recovery HD             650.0 MB   disk0s3

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +150.4 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Mac OS                  122.1 GB   disk1s1
   2:                APFS Volume Preboot                 20.3 MB    disk1s2
   3:                APFS Volume Recovery                506.6 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4

As you can see I resized the Recovery HD partition but the container is still 150gb. I also tried the following command to try reduce the container size:

sudo diskutil apfs resizeContainer disk0s2 1g jhfs+ Media 0b

But I get the following error:

Error: -69605: There is not enough free space in the APFS Container for this operation

Additionaly within Disk Utility app if I view the partitions, it shows I have 99.6 GB of "Free space" but I am unable to resize the Mac OS partition as previously mentioned.

Any help would be greatly appreciated, Thank you


Your Recovery HD is a leftover of a previous system version and probably unwanted.

High Sierra's recovery partition is inside the container:

3:                APFS Volume Recovery                506.6 MB   disk1s3

The command diskutil apfs resizeContainer disk0s2 1g jhfs+ Media 0b tries to resize disk0s2 containing all subsequent APFS Volumes to 1 GB and reclaim all freed-up space (150.4 GB - 1 GB = 149.4 GB) for another HFS+ partition Media).

This will fail because the basic operating system (disk1s1) alone has a size of at least ~10 GB.


You probably want to do the following:

  1. Remove the old Recovery HD

    diskutil eraseVolume "Free Space" %noformat% /dev/disk0s3
    
  2. Reclaim all available space for disk0s2:

    diskutil apfs resizeContainer disk0s2 0