Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you INCREASE the size of an APFS volume?

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

like image 539
Lumus Avatar asked Nov 29 '22 22:11

Lumus


2 Answers

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

like image 116
Sam G Avatar answered Dec 28 '22 07:12

Sam G


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.

like image 38
Thomas Avatar answered Dec 28 '22 07:12

Thomas