1

After I got done test driving Asahi Linux on my M1 Max, I decided to remove it and recover the allocated space, 500 GB (out of a total 2TB).

I uninstalled Asahi Linux from my Mac using the commands specified in their wiping script available [https://raw.githubusercontent.com/AsahiLinux/asahi-installer/main/tools/wipe-linux.sh]. That all went well, and I ended up with 500 GB unclaimed space.

The next step was to manually expand the MacOS partition to cover the unclaimed space with diskutil apfs resizeContainer disk0s2 0 - I ran this command, got distracted with something else, and while it was doing its thing, I ctrl-c'd. Mac hangs. I panic and restart the computer. (Yeah, I know.)

Computer boots up fine and data seems ok as well, but now I can't claim the space:

diskutil apfs resizeContainer disk3 0                                                                        amigo3


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

Here's the current partition layout according to diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk0
   1:             Apple_APFS_ISC Container disk1         524.3 MB   disk0s1
   2:                 Apple_APFS Container disk3         2.0 TB     disk0s2
   3:        Apple_APFS_Recovery Container disk2         5.4 GB     disk0s3

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.5 TB     disk3
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            9.1 GB     disk3s1
   2:              APFS Snapshot com.apple.os.update-... 9.1 GB     disk3s1s1
   3:                APFS Volume Preboot                 4.9 GB     disk3s2
   4:                APFS Volume Recovery                944.0 MB   disk3s3
   5:                APFS Volume Macintosh HD - Data     262.0 GB   disk3s5
   6:                APFS Volume VM                      20.5 KB    disk3s6

In the Disk Utility app, here's how this looks.

The drive appears as having 1.5TB.

The drive appears as having 1.5TB.

There's a "Macintosh HD" system volume that appears to be running off of a "startup snapshot":

There's a "Macintosh HD" system volume that appears to be running off of a "startup snapshot"

And a data volume "Macintosh HD - Data" (which I suppose has the contents of my "Macintosh HD" before the botched resizeContainer):

data volume "Macintosh HD - Data"

I'd like to make sure there is one Macintosh HD covering the SSD's 2TB, not 1.5TB.

I'm fairly sure this state can be recovered from without having to resort to a full drive format, but I guess I don't understand diskutil/ these partition concepts well enough. Is there a recipe I could apply here? Could I fix this by booting into System Recovery, removing the startup snapshot and expanding "Macintosh HD - Data"?

4
  • I can't speak to the size of the volumes, but the structure is correct and has been that way since macOS Catalina. You will note that Macintosh HD and Macintosh HD - Data are in the same container. Commented Jun 4, 2023 at 14:18
  • You can try diskutil apfs resizeContainer disk0s2 1T. If this executes without error, then try diskutil apfs resizeContainer disk0s2 0. Commented Jun 4, 2023 at 16:12
  • Thanks for taking a look, David and Marc. Will try those commands soon.
    – noon-ng
    Commented Jun 4, 2023 at 19:48
  • David, thank you! This seems to have worked. Feel free to post that as an answer and I can check it.
    – noon-ng
    Commented Jun 4, 2023 at 20:49

1 Answer 1

0

The diskutil list command shows the following.

  • There is a 2 TB partition of type Apple_APFS, which has been assigned the identifier disk0s2.
  • The partition disk0s2 contains a 1.5 TB APFS Container Scheme, which has been assigned the identifier disk3.

Normally, an APFS Container Scheme is the same size as the sum of the sizes of the containing partitions. In this case, there is only one containing partition (disk0s2), which should be the same size as the container (disk3), but instead is 500 GB larger.

The images posted of the Disk Utility show the following.

  • The version of macOS is 13.4 (Ventura).
  • The amount of free space in the disk3 container is 1.22 TB.
  • The size of the disk3 container is 1.5 TB.

The amount of space used in the disk3 container can be computed as 1.5 TB - 1.22 TB = 280 GB.


One method to expand both the partition and container sizes to the same maximum value would be to first significantly shrink the partition size, then expand the partition to be the maximum size. The commands are given below.

diskutil apfs resizeContainer disk0s2 1T
diskutil apfs resizeContainer disk0s2 0

Here the both changes to the partition size causes the diskutil command to also change the container size to match.

You must log in to answer this question.

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