newline

TIL: actually free up space on macOS APFS with tmutil

TIL, Mac

April 16, 2020

I deleted around 150 GB of files from my APFS volumes, but I ran into a strange issue. The storage section in “about this mac” showed the free space; however, df and Disk Utility both showed the old free space (which was around 8 GB). I figured out that this is because starting with High Sierra, drives with APFS create local snapshots that can be used by Time Machine to restore files. The snapshots are invisible to the filesystem, so you can’t find them with a simple du -skh *.

You can see the snapshots you have with the command

tmutil listlocalsnapshots /

If you don’t need these snapshots (e.g. you back up manually often enough), you can delete the snapshots with

tmutil deletelocalsnapshots YYYY-MM-DD-HHMMSS

(this is what I did).

An alternative is to thin the snapshots, with

tmutil thinlocalsnapshots volume_name purge_amount_bytes urgency

Urgency levels are 1-4, with 1 being the default. With urgency level 1, current backups will finish before thinning begins. The oldest backup is thinned first, and then thinning proceeds through the next oldest backups. With urgency level 4, any current backups are stopped and thinning happens immediately. Backups are thinned by size, starting with the largest.