How to Resize Your APFS Container on macOS High Sierra

2 minute read
| Deep Dive

If you’re running one of the macOS High Sierra betas and have tried to resize your APFS container without success, I’ve got the answer for you. You can’t currently do this from Disk Utility, so it requires some Terminal geekery. Of course, if you haven’t already migrated over to APFS, you might want to look into that first, with the help of John Martellaro.

resize your apfs partition

You’ve moved over to APFS under the High Sierra beta, and want to resize that partition, so here’s what you need to do (Image Credit: Pagefact)

Finding Where Your APFS Partition Lives

I’m confident that by the time High Sierra ships in the fall, this will be possible within the graphical Disk Utility. It’s a pretty common requirement, so Cupertino is bound to incorporate it more easily into the final version of macOS 10.13 High Sierra. For now, though, the Terminal is our friend.

To do this, you’ll need to open Terminal from Applications -> Utilities. Once there, issue this command to find out where your APFS container lives:

diskutil list

My output looks like the image below. Note that my APFS container is named /dev/disk1, and resides at /dev/disk0s2.

Locate, then resize your APFS container

Locating your APFS container prior to resizing it

Resizd Your APFS Container (the Hard Way)

Let’s talk about shrinking the APFS partition, or container, first. You use the same command for both processes, but you might be likely to want to reduce the size of your APFS partition first, perhaps to install another operating system on your Mac. To shrink my 1TB APFS container to 750GB, I’d issue the following command in Terminal:

sudo diskutil apfs resizeContainer disk0s2 750g jhfs+ Extra 250g

That command would resize the APFS container from 1TB to 750GB, also creating a 250GB journaled HFS+ partition with the freed space. We need to use sudo here, to take administrative privileges over the Terminal session.

I could have also issued the command like this, and diskutil would automatically determine the size for my new partition:

sudo diskutil apfs resizeContainer disk0s2 750g jhfs+ Media 0b

The output of the command will look something like this:

Resize your APFS container from Terminal

Resize you APFS container from Terminal

I could also create multiple partitions, using a command like this:

sudo diskutil apfs resizeContainer disk0s2 750g jhfs+ Media 200g FAT32 Windows 50g

Note that in my case, I could replace disk0s2 with disk1 for either command, since my APFS container is located at disk1. The diskutil command automatically locates the physical store for my APFS container, and resizes things accordingly.

Shrinking Your APFS Partition to Reclaim Space

If you decide you want to reclaim that space into your APFS container, you can do that using diskutil as well. First, though, you have to delete the JHFS+ or other partition and set it as free space on your hard drive. This command will do the trick, assuming your volume is named disk0s3.

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

Next, resize your APFS container:

diskutil apfs resizeContainer disk0s2 0

In this case, diskutil automatically claims all available free space on the physical storage device, but you can also replace 0 with a size value.

Yes, You Can Resize Your APFS Container on a Live Filesystem

Before you ask, yes, I’ve verified this process works even when you’re booted into High Sierra on that APFS volume. You will notice that your Mac becomes unresponsive for a time, as it verifies the filesystem, checks everything out, and then carries out the resize operation. For the best file integrity, though, I’d probably recommend doing this from Recovery Mode. I live on the bleeding edge, though, and did this from the live filesystem without any data corruption.

13 Comments Add a comment

  1. Travis Jacob

    When I do the final step to claim free space, I get an error saying the target disk is too small for this operation

    please help

    • Jeff Butts


      Sorry it’s taken me a while to get back to you. This is crucial: in the next to final step, did you try this command:

      sudo diskutil eraseVolume “Free Space” %noformat% /dev/disk0s3

      with curley quotes? If so, try it again, making sure you copy it from this comment, not from above. I just noticed that curly quotes snuck into my code snippet above.

      • polr

        Hi Jeff,

        I’m having the same issue as Travis, using your latest edit wit the non-curly quotes.

        Any idea what might be the issue?


    • Jeff Butts

      polr, I’m not sure what might be causing that, and the fact that the file system is so new means not many folks are posting yet about their exploits with APFS. Shoot me an email at jeffb (at) macobserver (dot) com, and include the output of diskutil list for me. I’ll see what I can make of it.

  2. sebastianginter

    I have a q.
    How to delete partition with APFS.? When i try delete from DiskUtility from Sierra Recovery Partition system tell me “cant umnount a disk” (this is the same disk – I have only one 128gb ssd with 3 partitions – Sierra, APFS High sierra and recovery sierra”. Can’t do this!
    And can’t resize partition APFS. I have only 25gb and can’t resize to 35GB!.
    It’s SAFE ?

  3. Jeff Butts


    As I explained in the above article, you can’t yet resize or delete APFS containers from Disk Utility. You have to use diskutil from the Terminal. Check this article and see if it helps. If not, shoot me a message and I’ll see if we can’t sort it out.

  4. Tyler Rheaume

    I am getting the error “Error: -69771: The target disk is too small for this operation” when running the last command. I am positive that I have the command correct and I have the APFS container selected.

  5. Jeff Butts

    To anyone running into the “the target disk is too small” issue, here’s what I believe is happening. APFS is only able to resize itself to space on the disk that exists beyond the last sector of the existing APFS container. If you have deleted a partition that was placed before the beginning of the APFS container, it won’t be accessible to resizing your existing APFS container.

    In such an instance, my recommendation is to make a clone of your APFS drive, using either Carbon Copy Cloner or Super Duper, and then repartitioning the entire drive the way you want it. Start fresh, basically. Then you can copy your clone back onto your drive.

    It’s a pain, but it’s a pain that exists with HFS+ volumes, too. You aren’t supposed to be able to delete the first partition on a drive, and you can’t grow a volume “backwards.” I.e., you can expand from the end of your existing partition towards the last sector on your drive, but you can’t expand from the beginning towards the first sector.

  6. WonderBrad

    Hi Jeff,

    When I try to resize the APFS container and create a new volume, using your first example, I get the error:

    APFS Container Resize error code is 49153
    Error: -69606: A problem occurred while resizing APFS Container structures

    Have you come across this before?


  7. iaboeyad

    Hi Jeff.

    Thank you for the explanation, it is really helpful

    Can I remove disk0s2 and merge it with disk0s4 ?
    disk0s2 was my old OS, now I installs OSX on disk0s4 I want to merge disk0s2 into disk0s4 ? is that possible or it should be in order ?


Add a Comment

Log in to comment (TMO, Twitter, Facebook) or Register for a TMO Account