4

On a 120GB SSD hard drive in a MacBook only 70GB are available. The missing 50GB are not even shown as free space.

Here is what the output of Disk Utility looks like:

enter image description here

enter image description here

enter image description here

As you can see on the first screenshot the disk has 120GB. However, the partition chart on the same screenshot only shows 70GB. Also the other two screenshots show that only 70GB out of 120GB seem to be available.

The command diskutil list shows that the physical disk0 is 120GB big, but the synthesized disk1 only 70GB:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         70.0 GB    disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +70.0 GB    disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            60.2 GB    disk1s1
   2:                APFS Volume Preboot                 21.7 MB    disk1s2
   3:                APFS Volume Recovery                509.9 MB   disk1s3
   4:                APFS Volume VM                      2.1 GB     disk1s4
  • Please don't post an answer inside your question's body! Instead either create a new answer or accept the existing answer! – klanomath Mar 21 '18 at 15:28
5

You previously installed Windows (or another OS) and deleted it afterwards - except an orphaned Apple_BOOT or 2nd EFI partition (disk0s3 - 134.2 MB).

The 50 GB are simply unallocated disk space.

To expand your APFS container you have to remove the third partition and resize the container:

First convert the third partition to free space:

sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0s3

Then expand your APFS container to the max (0 is a magic size here):

diskutil apfs resizeContainer disk0s2 0
  • Hi, thanks for the reply. The first command ran OK, after the second the screen froze and only the mouse is moving. Are you sure it was the right command? I'm just wondering if it should have been disk1s1 and not disk0s2. Do you have an idea? – Stan Mar 20 '18 at 13:07
  • @Stan disk1s1 is no APFS container,but an APFS volume inside the container disk0s2! Disk1 is a synthesized disk based on disk0s2 containing all required APFS volumes: preboot, recovery, vm and the main system. – klanomath Mar 20 '18 at 13:24
  • I see about the containers. I'm able to boot my mac now, but the space didn't come back. I update my original post with some more information, if you have time to have a look. – Stan Mar 20 '18 at 17:26
  • 1
    @Stan I already read it ;-) – klanomath Mar 20 '18 at 17:26
  • 1
    @Stan Please check the various disk and file systems: diskutil verifyDisk disk0, diskutil verifyVolume disk0s2 and finally diskutil verifyVolume disk1s1! – klanomath Mar 20 '18 at 17:31
1

The solution

The amazing klanomath, who posted the first reply guided me through the debugging process and we were able to solve the problem. At this point I would like to thank him for all the time he took to help me.

The problem seemed to be that in the past I installed a different OS using Bootcamp, and after I deleted it Bootcamp failed to return the space that was allocated for it, so that 50GB of space got orphaned.

One hint to this is is the volume disk0s3 that one can see on the first screenshot. This was probably the bootloader for the other OS.

Here are the steps that led to the solution:

  1. Probably it is a good idea to make a Time Machine backup before messing with the hard drive.

  2. Delete disk0s3 by running

    sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0s3
    
  3. Boot into the Internet Recovery Mode by restarting your computer and holding Alt+Cmd+R while booting. Then open the Terminal via Menu Bar → Utilities

  4. The architecture of the hard drive is the following: disk0 is the physical storage, on top of it is the container disk0s2. This container accommodates the synthesized disk1, which, in turn, contains the volume disk1s1. For some reason, when I booted into the Recovery mode my disk1 became disk2 and disk1s1 became disk2s1. Make sure you insert the correct labels. The commands diskutil list and diskutil ap list are helpful to single out the right ones.

  5. Unlock disk1s1 by running diskutil ap list and copy its UUID, in our case it's 9AFD4588-AA1A-3413-9335-6C8DA8EA3973. Then run

    diskutil ap unlockVolume 9AFD4588-AA1A-3413-9335-6C8DA8EA3973
    

    and enter your password. You don't need to lock it afterwards.

  6. Run some checks on the disks, containers, and volumes that we are going to modify:

    diskutil verifyDisk disk0
    diskutil verifyVolume disk0s2
    diskutil verifyVolume disk1s1
    

    and make sure there are no errors.

  7. Grow the disk0s2 container:

    diskutil ap resizeContainer disk0s2 0
    

    The zero at the end is a magic number that makes sure the container is grown to the maximum.

  8. Verify the result with diskutil list and diskutil ap list.

Here is my end result:

enter image description here

enter image description here

enter image description here

diskutil list:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         121.1 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +121.1 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            60.1 GB    disk1s1
   2:                APFS Volume Preboot                 22.4 MB    disk1s2
   3:                APFS Volume Recovery                509.9 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4

diskutil ap list:

APFS Container (1 found)
|
+-- Container disk1 E18387BD-AC00-4EC1-9446-C865C525F706
    ====================================================
    APFS Container Reference:     disk1
    Capacity Ceiling (Size):      121123069952 B (121.1 GB)
    Capacity In Use By Volumes:   61859213312 B (61.9 GB) (51.1% used)
    Capacity Available:           59263856640 B (59.3 GB) (48.9% free)
    |
    +-< Physical Store disk0s2 727CB82C-B58F-4B11-BB65-7177A5951E29
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s2
    |   Size:                       121123069952 B (121.1 GB)
    |
    +-> Volume disk1s1 9AFD4588-AA1A-3413-9335-6C8DA8EA3973
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s1 (No specific role)
    |   Name:                      Macintosh HD (Case-insensitive)
    |   Mount Point:               /
    |   Capacity Consumed:         60126756864 B (60.1 GB)
    |   FileVault:                 Yes (Unlocked)
    |
    +-> Volume disk1s2 6F75B394-3A04-419B-A2AF-62270D0DB902
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s2 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         22441984 B (22.4 MB)
    |   FileVault:                 No
    |
    +-> Volume disk1s3 AACD802A-DC54-4D3E-8556-BE56B7D229B7
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s3 (Recovery)
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         509853696 B (509.9 MB)
    |   FileVault:                 No
    |
    +-> Volume disk1s4 13865AE2-BA44-4DD2-8A37-80169D319CC4
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk1s4 (VM)
        Name:                      VM (Case-insensitive)
        Mount Point:               /private/var/vm
        Capacity Consumed:         1073786880 B (1.1 GB)
        FileVault:                 No

P.S.: At first I tried to grow the container from the operating system, and not from the recovery mode, and run diskutil ap resizeContainer disk0s2 0 in the terminal without any unlocking. This did not work and my computer froze except for the mouse, so that a reset via the power button was necessary. This was quite a scary moment!

You must log in to answer this question.

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