Why does OmniDiskSweeper report different amounts of free space than About This Mac? What is "purgeable" space?


#1

If you check the amount of free space listed in About This Mac and the amount of free space listed for the same drive in OmniDiskSweeper, you’ll see different numbers. Why are those numbers different?

The quick answer:

“About This Mac” includes “purgeable” space as free/available space.

When you open Disk Utility and select your disk, you can see more detail about how Apple treats available disk space:

image

The “purgeable” space is space that the operating system knows how to reclaim when you try to create files that need that space. But it’s not truly cleared up from the disk yet and still shows up in OmniDiskSweeper’s summary list. But even though it shows up in the summary, it won’t show up when you browse the disk looking for files to delete—so OmniDiskSweeper will end up reporting different numbers for space used based on how it scans your disk. To understand why, read on…


OmniDiskSweeper has two ways of finding the amount of space being used on a disk. The drive list (the first window you see when you open the app) asks each drive for its current usage stats and simply reports those. This reports the same numbers you’d see if you ran df at the command line.

The other number is what you see when you start at the top directory on the disk and work your way through each file on the disk, adding up the sizes as you go. This is the number you see at the top of the window of the file browser, and is much like what you’d see if you ran du on that same folder at the command line.

Those two numbers aren’t guaranteed to match up, because a process can create a file, open a file, remove it, but still leave it open. The process can continue to use that file, so it still needs space, but no other process can get to it since it no longer has an entry on the filesystem—its space will get reclaimed when the file is closed (such as when the process that has it open finally terminates).

And that was just in the traditional filesystem world.

With the new apfs filesystem, it’s also possible to take snapshots of the filesystem at a particular moment in time, which freezes all of its files in that moment’s state until the snapshot goes away. This is part of the mechanism Time Machine uses for its backups.

These snapshots can take nearly zero space at the start (because their contents are exactly the same as the current files on disk), but as files get edited or removed the snapshots start to take up more and more space. In particular, when you delete huge files (because you’re trying to clear up space), they will disappear from your filesystem but will still exist in your snapshots until those are removed. This is where I usually find the bulk of the “purgeable” space reported in Disk Utility.

Unfortunately, I haven’t yet discovered any API to directly see those snapshots and how much space they take. But you can manipulate them from the command line and learn what snapshots exist, deleting snapshots you no longer want to keep around:

sudo tmutil listlocalsnapshots /
sudo tmutil deletelocalsnapshots 2018-11-05-162436

Sadly, iTunes doesn’t understand how to free up purgeable space, so when I got my new iPhone and tried to use my Mac to back up my old iPhone and restore it to my new iPhone, it thought I was out of space even though Finder and About This Mac claimed there was plenty of space available. The secret was that all that space was still claimed as purgeable space, and the solution was to first make sure my Time Machine backups had made it to my external Time Machine disk, then purge all the local snapshots using the process above. Once I’d done that, iTunes was able to complete its backup and restore.

Someday, I hope to find a way to add better support for purgeable content to OmniDiskSweeper. But in the meantime, I hope this helps folks understand the discrepancy they may see between the numbers it reports vs. the numbers you see reported in some other places!


#2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.