Tuesday, January 19, 2021

How to Reserve Time Machine Space on an APFS Drive

Glenn Fleishman:

What Apple appears to be saying is an APFS Time Machine volume requires a single container that takes up the entire disk—you can’t add other containers, and that container has access to all the store space on the disk. Within that container lives a Time Machine volume. If you want to use the disk for other purposes, don’t add a container; instead, use Apple’s advice and add a volume within the existing container.

That is limiting, because the Time Machine backup could eventually swell to fill the entire available storage in the container (and disk), crowding out the other volume or volumes you create.

Previously:

11 Comments RSS · Twitter


Am I missing something, or does the article not fulfill the thesis offered by its title? The conclusion seems to be, simply, that space CANNOT be designated for Time Machine in an APFS container.


All I know is that a few years ago this stuff worked well and was eaSy to understand, even by mere mortals like me.

Now backing up your Mac seems to require an advanced degree in computer science.

I can't help but feel that APFS made everything so much harder to understand that no one really knows how to do anything. It might be much better at doing many things, but only for the three people in Cupertino that know how to configure their backup partitions.


@Ben Yes, I think the answer is that you can’t. :(


Actually, I think you can reserve space. When you add a new volume to a container, you can put a "reserve size" under "size options…" which seems to guarantee that amount of space to the additional volume.


@Andrew I think the terminology is getting confusing. If I read his comment correctly, @Ben thought the article might tell us how to _limit_ the amount of space that Time Machine can use when Time Machine is pointed at a volume in an existing container. I've had the same question and it apparently is not possible.

Let's say I have a 1TB disk with a single APFS container that takes up the entire disk and 500GB of free space on that disk. If I add a new volume to that container, I can use that volume for Time Machine. However, Time Machine will be allowed to take up all 500GB if it wants. There's no way to limit that volume to a maximum size of, say, only 250GB.


@Sean I think this is all possible, although it might depend on the order of operations. When you add a new volume to a container, you can specify a minimum ("reserve") size or a maximum ("quota") size.

In my case, I had an external drive that had been formatted by APFS via the Time Machine interface itself, which makes a single-volume container taking up all the space on the drive. I then added a second volume for non-TM use, which I gave a "Reserve Size", which I think has the effect of decreasing the available size to the original TM volume.


I can’t help but feel that APFS made everything so much harder to understand that no one really knows how to do anything.

In theory, they made partitioning nicer with their space sharing feature.

In practice, that would be a lot more useful if each macOS instance were actually constrained to a particular volume (or a set of volumes). Instead, we have these weird special volume types, and installing a newer beta macOS on a particular volume also upgrades the bootloader for all volumes, and… what, if not being able to isolate those installs, even is the point of multiple volumes?

Add to that Apple’s usual reticence at documenting this stuff.

I do like that they’ve moved away from the aging HFS+, with rather few glitches. I don’t like how complexity has increased since, and other factors such as performance or maintenance capabilities (e.g., there still is nothing like ‘merge adjacent containers’ — if you accidentally wind up with multiple adjacent containers that cannot share space, like I have, there’s nothing you can do but move all data) haven’t.


Due to Apple's insistant prompting and because they didn't know any better and neglected to ask me first, my parents upgraded their laptop to Big Sur, which broke the backup system that I had set up for them with SuperDuper! (which is not Big Sur-ready yet). I had a SuperDuper! backup to an external drive formatted as APFS. As far as I can tell, even though there's ample room on it, it's impossible to use that external drive for Time Machine backups **without erasing it first**. So maybe you can use an APFS disk for Time Machine backups and **then** add other APFS volumes on that disk/container to use for other purposes (like SuperDuper! backups?), but you can't do the opposite. (I certainly don't want to reformat the drive and erase the existing backup. That's too much of a risk. I don't really trust Apple/Time Machine all that much.)

End result is that my parents are now (temporarily) without a backup system, thanks to Apple's idiotic policy of pushing every user to upgrade to the latest OS as soon as possible. They have learned their lesson, but the damage is done.


In the past, it was possible to manually limit the size of Time Machine backups via the following terminal command "sudo defaults write /Library/Preferences/com.apple.TimeMachine MaxSize -integer XX" where XX is the size in MB.

Has anyone tried to see if it's working when backing up to an APFS drive?

Source: https://www.defaults-write.com/time-machine-setup-a-size-limit-for-backup-volumes/


Yes it's possible, but not by the Disk Utility, because you can't set a role to your Volume by this way. But the diskutil command by the terminal application do it very well.

For example, i've a Container of 80 Go and i want create a Time Machine volume how will not exceed 20 Go :

xxxxxxx ~ % diskutil ap list disk4

|
+-- Container disk4 8C53B410-FC36-4221-9F13-F528C24CA4EC
====================================================
APFS Container Reference: disk4
Size (Capacity Ceiling): 80000000000 B (80.0 GB)
Capacity In Use By Volumes: 121966592 B (122.0 MB) (0.2% used)
Capacity Not Allocated: 79878033408 B (79.9 GB) (99.8% free)
|
+- No Volumes
In the following command

APFSX is for the APFS Case-sensitive format (for the saves TM)

-quota 20g limits growth to 20 Go for this volume

-role T indicate that the volume is a "Backup TM"

xxxxxxx ~ % diskutil ap addvolume disk4 APFSX Time_Machine_BS -quota 20g -role T

Will export new APFS (Case-sensitive) Volume "Time_Machine_BS" from APFS Container Reference disk4 with a 20000000000-byte quota
Started APFS operation on disk4
Preparing to add APFS Volume to APFS Container disk4
Creating APFS Volume
Created new APFS Volume disk4s1
Mounting APFS Volume
Setting volume permissions
Disk from APFS operation: disk4s1
Finished APFS operation on disk4
xxxxxxx ~ % diskutil ap list disk4

|
+-- Container disk4 8C53B410-FC36-4221-9F13-F528C24CA4EC
====================================================
APFS Container Reference: disk4
Size (Capacity Ceiling): 80000000000 B (80.0 GB)
Capacity In Use By Volumes: 122675200 B (122.7 MB) (0.2% used)
Capacity Not Allocated: 79877324800 B (79.9 GB) (99.8% free)
|
+- Volume disk4s1 8E6FC6CF-149A-4A8C-BD4E-228953A8C07F
---------------------------------------------------
APFS Volume Disk (Role): disk4s1 (Backup)
Name: Time_Machine_BS (Case-sensitive)
Mount Point: /Volumes/Time_Machine_BS
Capacity Consumed: 704512 B (704.5 KB)
Capacity Reserve: None
Capacity Quota: 20000002048 B (20.0 GB) (0.0% reached)
Sealed: No
FileVault: No
If there is no volume selected for Time Machine saves, immediately TM proposes to use this volume.

After the first save (small because i'm on a test Big Sur install) the result is :

xxxxxxx ~ % diskutil ap list disk4

|
+-- Container disk4 8C53B410-FC36-4221-9F13-F528C24CA4EC
====================================================
APFS Container Reference: disk4
Size (Capacity Ceiling): 80000000000 B (80.0 GB)
Capacity In Use By Volumes: 6738415616 B (6.7 GB) (8.4% used)
Capacity Not Allocated: 73261584384 B (73.3 GB) (91.6% free)
|
+- Volume disk4s1 8E6FC6CF-149A-4A8C-BD4E-228953A8C07F
---------------------------------------------------
APFS Volume Disk (Role): disk4s1 (Backup)
Name: Time_Machine_BS (Case-sensitive)
Mount Point: /Volumes/Time_Machine_BS
Capacity Consumed: 6616440832 B (6.6 GB)
Capacity Reserve: None
Capacity Quota: 20000002048 B (20.0 GB) (33.1% reached)
Sealed: No
FileVault: No
The limitation is that it's impossible, to my knowledge, to modify the quota without suppress and re-create the TM volume.


Two years later, the solution described by Jean_JD no longer works. With macOS 13, the TM volume can be created with a quota and the volume accepted by TM without any change. But after the first backup, the quota has been silently removed!

Leave a Comment