2

I have around 20 GB of unallocated space that does not appear in diskutility. I would like to allocate it back into Macintosh HD. I am not very experienced in terminal, but here is what I have.

   #:                       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    -

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +161.8 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD - Data⁩     115.4 GB   disk1s1
   2:                APFS Volume ⁨Preboot⁩                 483.6 MB   disk1s2
   3:                APFS Volume ⁨Recovery⁩                626.2 MB   disk1s3
   4:                APFS Volume ⁨VM⁩                      1.1 GB     disk1s4
   5:                APFS Volume ⁨Macintosh HD⁩            22.3 GB    disk1s5
   6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 22.3 GB    disk1s5s1
   7:                APFS Volume ⁨Untitled⁩                802.8 KB   disk1s7

Where do I go from here? I have tried resizing my partitions, but I am missing the 20 gbs.

Image:

enter image description here

I have restarted multiple times. Please assist me if you can.

1
  • It's unfortunate that the drive is displayed as a pie chart. Displaying it as a stacked bar chart would be a more accurate representation and make it quite clear why this isn't working.
    – Mark
    Commented Dec 10, 2021 at 0:30

2 Answers 2

8

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.

6
  • 1
    It's possible that they might be able to move the Bootcamp partition as well. I know you can move partitions in Linux and I've found programs that will let me do so in Windows, but I don't know about macOS.
    – trlkly
    Commented Dec 9, 2021 at 17:47
  • @trlkly Yes, the link that @bmike added to my answer contains a helpful comment by David Anderson about using dd to incrementally move portions of a partition. This is, however, not a point-and-click procedure on macOS (although there may be third-party utilities available that make this easy).
    – pion
    Commented Dec 9, 2021 at 17:50
  • I've already deleted partition though, that's the issue. It's just 18.8 GBs of unallocated space that I can't access. I can turn the unallocated space into a windows partition, but I can't put any of that space back into my Macintosh disk. Apologies if I completely missed the point.
    – RRPQ
    Commented Dec 9, 2021 at 23:32
  • 1
    Deleting the bootcamp partition is absolutely unnecessary. MiniTool Partition Wizard, when run from Windows, CAN resize and relocate the boot partition without corrupting the Windows OR macOS partitions. I know because I've successfully pulled this off on my own MacBook. Crucially, do NOT try to touch your APFS partition from Windows - just move the Windows partition forward, then reboot into macOS and use Disk Utility to expand the macOS partition.
    – Dev
    Commented Dec 10, 2021 at 0:55
  • 1
    @Dev I've never tried this myself but sounds neat! I would strongly advise the OP to perform a full backup of their entire drive before trying this :)
    – pion
    Commented Dec 10, 2021 at 1:00
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .