Missing around 20 GB of Space on MacBook
Let's take a closer look at your GUID Partition Table (GPT):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_APFS Container disk1 161.8 GB disk0s2
3: Microsoft Basic Data BOOTCAMP 68.7 GB disk0s3
(free space) 20.3 GB -
The GPT is the "low-level" foundational layer that sits underneath more "abstract" constructs (such as the APFS Container). Being a more primitive data structure, GPT mandates that each partition (of which you currently have three) is one contiguous block, with a single starting point, a single ending point, and no gaps in between.
The second of your three partitions is the APFS Container, whose contents are detailed in the bottom half of the diskutil
output you provided. Within this container, any free space is available as a common pool across all volumes, because APFS was designed to have this as a key feature.
However, beyond the APFS partition is a separate Bootcamp partition. This is why there isn't a clean way to reclaim your 20 GB of free space back into Macintosh HD: The APFS container, which holds Macintosh HD, ends where the Bootcamp partition begins. The APFS container can't skip past another, separate partition in order to reach your unallocated space.
You would need to delete your Bootcamp partition and then grow the APFS partition by 20 GB, and then (if you still want it) recreate and repopulate Bootcamp.
There are third party tools that can move the Windows partition (disk0s3
), so the free space appears after the macOS partition (disk0s2
). Once moved, the command below can be used to add the free space to the macOS partition (disk0s2
).
diskutil apfs resizecontainer disk0s2 0
One free third party tool that can move the Windows partition is GParted. Basically, you create a bootable GParted USB flash drive, boot from this flash drive and use Gparted to move the Windows partition. Afterwards, boot back to macOS and use the above command to add the free space to the macOS partition (disk0s2
).
I should point out that GParted can also be booted from an optical drive or a partition on the internal drive. The instructions for doing so are not included in this answer.
I should warn that you would be moving a lot of data, which could take a considerable amount of time. Also, if the move operation is interrupted, you probably would not be able to recover and the Windows partition would be lost.
Other References
- ntfsresize(8) - Linux man page
- NTFS Partition Boot Sector