How to reclaim free space partition on macOS High Sierra?
To convert an APFS container to free space you'd have to delete the container first:
diskutil ap deleteContainer disk1
Then you can demote the partition to unallocated disk space with:
diskutil eraseVolume "Free Space" %noformat% /dev/disk0s2
You won't be able to reclaim more disk space for your remaining container disk2 (disk0s3) though, because you can't expand disk0s3 to lower block numbers.
As of today you can't move APFS volumes between APFS containers.
Your options are then:
-
Reboot to Internet Recovery Mode
- create a partition
disk0s2
in the unallocated disk space with gpt. The partition has to have the same size and type as disk0s3. - unmount all container
disk2
volumes -
dd
disk0s3
todisk0s2
- delete Container
disk2
- expand the remaining container
- create a partition
-
Install High Sierra to container
disk1
(the containerdisk1
mustn't be erased as described in the first part then) and import data from containerdisk2
.- delete Container
disk2
afterwards - expand the remaining Container disk1
- delete Container
Backup Mac 2 with Time Machine and restore it after booting to Internet Recovery Mode to a completely erased and repartitioned
disk0