How do you INCREASE the size of an APFS volume?
Asked Answered
F

3

10

I've created an APFS volume on a MBP running High Sierra in order to use it as a Time Machine drive for the iMac I use at work (we don't have a backup solution so this is my hacky way to keep myself safe as the MPB itself is backed up separately).

I foolishly assumed 100GB would be enough (as I only back up certain folders) however in less than a week the iMac has filled it and Time Machine is complaining about insufficient disk space.

I am trying to figure out a way to expand the volume (to say 150GB) however every help page and blog I can find shows you how to shrink a container.

I've tried using Disk Utility but it doesn't give me the option to resize individual volumes (only the overall container). Disk Utility Screenshot

I've also tried using the diskutil in terminal but don't want to break things.

I'd prefer not to dump and re-create the partition of possible, but if it's the only option I will deal with it.

Cheers

Matt

Fulcrum answered 7/12, 2017 at 21:53 Comment(0)
L
25

Find out your container first with: diskutil apfs list

Say you found out its disk0, then you do:

sudo diskutil apfs resizeContainer disk0 0

In my example (see screenshots) you see that disk1 container grew, and this was the one line in the output that indicates a happier you:

"Growing APFS Physical Store disk0s2 from 864,999,997,440 to 1,000,345,825,280 bytes"

Before and after output of diskutil list: (note disk1)

enter image description here enter image description here

Lasonyalasorella answered 11/1, 2018 at 2:58 Comment(2)
The value of 0 for the last argument is explained by the man page for diskutil: "You can specify a size of zero (0) to grow the targeted APFS Physical Store such that all remaining space is filled to the next partition or the end of the partition map." Alternatively, you could specify the new size that you want for the volume, if for example you don't want it to take up all remaining space to next partition or end of partition map.Encaenia
great answer, this helped me resize my APFS container, thank you. I have FileVault involved as well, so my first attempt complained resize was not possible because some volumes were locked. Running diskutil apfs unlockVolume disk5s1 (replacing the exact volume reference with whatever you need of course) unlocked it then the resize worked.Bran
J
4

Short answer: APFS volumes cannot be resized, only APFS containers.

Longer story: An APFS volume exists inside an APFS container but not outside of it. That APFS container is the "thing" that in reality occupies space, i.e. bytes, on a medium, not the APFS volume. Hence only APFS containers can be resized but not APFS volumes. If one thinks of APFS volumes as being "just fancy labels for virtual space", then it becomes much clearer what is what. The direct effect of this is that within an APFS container the volumes coexist and compete for the remaining/free/unallocated space of the container.

Jasso answered 5/7, 2020 at 8:14 Comment(0)
B
1

The longer story is true.

But does not mention two facts about APFS volumes.

Quota: When creating a volume, the use can specify the maximum space that new volume will be allowed to use, of the total space in that volume's container. That volume can not use more space.

Reserve: When creating a volume, the use can specify an amount of space in the container, which will be reserved for that new volume. No other volume in the container can use space that would reduce the available space below the sum of the reservations of the other volumes.

So, the next question is: can the quota or reserve be changed? Not using Disk Utility. How about using diskutil in the Terminal interface? (Answer: maybe so. But, dear reader, be very careful. And know that Apple Care says: "We do not support Terminal.")

Bully answered 15/10, 2022 at 16:40 Comment(2)
For Time Machine specifically, there is a different way to set the quota: tmutil setquota. See also discussions.apple.com/thread/255220939?sortBy=bestHydroelectric
What do you mean "maybe so"? Any help on how to do that?Cajuput

© 2022 - 2024 — McMap. All rights reserved.