MacOS – 161gb not appearing on diskutil after deleting second OSX partition

apfsdisk-spacemacosmojavesystem-information

I deleted my second OSX partition and I'm missing 161gb of space. It's not appearing on diskutil or Disk Utility. I have to keep the Untitled2 partition because it stores files I need.

Disk Utility Screensot

diskutil list

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         172.5 GB   disk0s2
   3:                 Apple_APFS Container disk2         167.6 GB   disk0s3

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +172.5 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Untitled2               141.5 GB   disk1s1

/dev/disk2 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +167.6 GB   disk2
                                 Physical Store disk0s3
   1:                APFS Volume Macintosh HD            108.3 GB   disk2s1
   2:                APFS Volume Preboot                 45.0 MB    disk2s2
   3:                APFS Volume Recovery                512.8 MB   disk2s3
   4:                APFS Volume VM                      1.1 GB     disk2s4

diskutil apfs list

APFS Containers (2 found)
|
+-- Container disk1 4CA49CB7-0B51-487F-AC91-843A00AACD56
|   ====================================================
|   APFS Container Reference:     disk1
|   Size (Capacity Ceiling):      172464693248 B (172.5 GB)
|   Capacity In Use By Volumes:   141663903744 B (141.7 GB) (82.1% used)
|   Capacity Not Allocated:       30800789504 B (30.8 GB) (17.9% free)
|   |
|   +-< Physical Store disk0s2 D50CC799-F508-4BC3-99B7-D88453067192
|   |   -----------------------------------------------------------
|   |   APFS Physical Store Disk:   disk0s2
|   |   Size:                       172464693248 B (172.5 GB)
|   |
|   +-> Volume disk1s1 8FC2013D-3475-4D7A-B782-34120455DBEA
|       ---------------------------------------------------
|       APFS Volume Disk (Role):   disk1s1 (No specific role)
|       Name:                      Untitled2 (Case-insensitive)
|       Mount Point:               /Volumes/Untitled2
|       Capacity Consumed:         141533384704 B (141.5 GB)
|       FileVault:                 No (Encrypted at rest)
|
+-- Container disk2 525596F2-BF28-4B79-8A69-980E08DCA7B8
    ====================================================
    APFS Container Reference:     disk2
    Size (Capacity Ceiling):      167607386112 B (167.6 GB)
    Capacity In Use By Volumes:   110029500416 B (110.0 GB) (65.6% used)
    Capacity Not Allocated:       57577885696 B (57.6 GB) (34.4% free)
    |
    +-< Physical Store disk0s3 E0DF7FC9-10C9-48EB-B1D3-955CF2604696
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s3
    |   Size:                       167607386112 B (167.6 GB)
    |
    +-> Volume disk2s1 1AD64FB4-1024-4B39-9429-B4A7493D28D7
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s1 (No specific role)
    |   Name:                      Macintosh HD (Case-insensitive)
    |   Mount Point:               /
    |   Capacity Consumed:         108267294720 B (108.3 GB)
    |   FileVault:                 No (Encrypted at rest)
    |
    +-> Volume disk2s2 BB7D5886-DEB8-4044-BD11-477B9241B902
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s2 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         44994560 B (45.0 MB)
    |   FileVault:                 No
    |
    +-> Volume disk2s3 E0FCF8A4-B9EE-4933-A159-01FE53268518
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s3 (Recovery)
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         512753664 B (512.8 MB)
    |   FileVault:                 No
    |
    +-> Volume disk2s4 0C55D779-851D-4F4A-BB98-31480E17A910
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk2s4 (VM)
        Name:                      VM (Case-insensitive)
        Mount Point:               /private/var/vm
        Capacity Consumed:         1073762304 B (1.1 GB)
        FileVault:                 No (Encrypted at rest)

diskutil info disk0s2 | grep -e Offset -e Size

   Partition Offset:          160205692928 Bytes (39112718 4096-Byte-Device-Blocks)
   Disk Size:                 172.5 GB (172464693248 Bytes) (exactly 336845104 512-Byte-Units)
   Device Block Size:         4096 Bytes

diskutil info disk0s3 | grep -e Offset -e Size

   Partition Offset:          332670386176 Bytes (81218356 4096-Byte-Device-Blocks)
   Disk Size:                 167.6 GB (167607386112 Bytes) (exactly 327358176 512-Byte-Units)
   Device Block Size:         4096 Bytes

The above information can be summerized in the table given below.

starting sector  ending sector  # of sectors  identifier
---------------  -------------  ------------  ---------- 
                                     ~76,806  disk0s1
     39,112,718     81,218,355    42,105,638  disk0s2
     81,218,356    122,138,127    40,919,772  disk0s3

Total number of sectors = ~122,143,554.
There are 4096 bytes per sector.

The largest block of free space occurs before disk0s2 and disk0s3 and can be approximated by the equation shown below.

(39,112,718 - 76,806) * 4096 = 159,891,095,552 bytes.

Best Answer

After a lot of back and forth in comments, it’s looking like you have a couple containers that won’t collapse back into one chunk of space, so you’ll want to live with this until such time as you make a backup, wipe the APFS containers, recreate one container and then re-make all your volumes in one APFS container and reinstall the OS / restore the data from backup.


I'm thinking you added a partition when you just needed to add a volume to the same container so all the volumes could share free space and not block each other from using the full free space:

enter image description here

If you clicked Add Volume you would only have one container and the Untitled2 volume would be quick and easy to delete and not take any space away from the other volumes in the same container.

bootable volume - slim

Untitled2 volume

$ diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume slim                    199.5 GB   disk1s1
   2:                APFS Volume Preboot                 65.5 MB    disk1s2
   3:                APFS Volume Recovery                1.0 GB     disk1s3
   4:                APFS Volume VM                      2.1 GB     disk1s4
   5:                APFS Volume Untitled2               647.2 KB   disk1s5

In your case - the parts of disk0 are mutually exclusive and the disk0s3 is locking away 167.6 GB of space from the main container.

In my case, you can see that both volumes see the same amount of free space and you'll not have that flexibility since you have two high level "Containers" that can't share free space.

System Information storage view from the About This Mac storage pane

Assuming you just want to get rid of the second container are you more comfortable deleting from Disk Utility or the command line?