Missing disk space on macOS

I have a 250G disk on my Mac with around 100G in use. But the system reports only around 20G of free space. I'm using macOS 10.13.2. I have the problem at least since the upgrade to High Sierra, but probably also before.

"About This Mac" --> "Storage" reports that "System" is using around 180G. But if I check the complete disk, it looks like that:

$ sudo du -cxhd 1 /
  0B    /.HFS+ Private Directory Data
1.0K    /home
4.3G    /usr
4.2G    /.Spotlight-V100
1.0K    /net
 34G    /nix
  0B    /.PKInstallSandboxManager
  0B    /.PKInstallSandboxManager-SystemSoftware
2.6M    /bin
  0B    /Network
1.1M    /sbin
3.8G    /Library
  0B    /.Trashes
6.5G    /System
476K    /.fseventsd
du: /private/var/db/ConfigurationProfiles/Store: Operation not permitted
du: /private/var/folders/z7/[...]/0/SafariFamily: Operation not permitted
du: /private/var/folders/z7/[...]/0/com.apple.LaunchServices.dv: Operation not permitted
du: /private/var/folders/z7/[...]/0/com.apple.nsurlsessiond: Operation not permitted
du: /private/var/folders/z7/[...]/0/com.apple.routined: Operation not permitted
du: /private/var/folders/zz/[...]/0/com.apple.nsurlsessiond: Operation not permitted
8.0G    /private
8.6M    /.DocumentRevisions-V100
  0B    /.vol
 32G    /Users
 11G    /Applications
207M    /opt
5.0K    /dev
4.0K    /Volumes
  0B    /cores
104G    /
104G    total

df also says that only 20G are available:

$ df -h /
Filesystem     Size   Used  Avail Capacity iused               ifree %iused  Mounted on
/dev/disk1s1  234Gi  211Gi   20Gi    92% 4019132 9223372036850756675    0%   /

Any tool I was using (Finder, Disk Inventory X, etc.) shows more or less the same numbers like df and du.

Output of mount:

$ mount
/dev/disk1s1 on / (apfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk1s4 on /private/var/vm (apfs, local, noexec, journaled, noatime, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)

I read and tested many, many things like:

  • https://superuser.com/questions/1270727/macos-10-13-1-high-sierra-disk-space-imac
  • https://superuser.com/questions/1259175/mac-disk-full-error-but-plenty-of-space
  • High Sierra disk space issues
  • How can I figure out what's slowly eating my HD space?

... but with no success. So what could consume more than 100G of disk space without showing up in any tool?

Update

Running „First Aid“ in recovery mode: first aid

What does this error message mean?

error: btn:1: invalid key order (1) oid 440198 / oxid 114577
fsroot tree is invalid.

Update 2018-01-25

Another report of the same error: https://discussions.apple.com/thread/8246182 (but no answers, yet)

I'm pretty sure this file system error is the root cause for the missing disk space. But I have no idea how to fix that. I was hoping that 10.13.3 would maybe solve it, but it didn't change anything. I guess I need to reinstall...


Solution 1:

It seems like the two most likely candidates are a mounted (shared) disk overwriting a location with large files, hiding them from your view, or large (or many many small) files that are held open by a process, but have already been deleted. If you haven't rebooted the computer yet, that's worth a shot, but also booting into recovery mode and running first aid on the disk might help. lsof | grep deleted might also reveal interesting information, if lsof is available on OSX (I assume it is, but I've never looked)

I've also noticed in my own use that if I use a tool like DiskInventory or Grand Perspective and there are other users on the system, they won't show the size of other users files if I don't have read access to them (reasonably so). If you have other users on your system, they may have large files in their home directory you're not seeing.

Solution 2:

I finally reinstalled the system after erasing the volume. With a Time Machine backup it was more or less a smooth experience. Now I have 170G of free space.

tl;dr:

  • Missing disk space can be related to a broken filesystem
  • APFS tooling is currently really bad, you probably need to erase the volume and reinstall to fix any filesystem problem

Solution 3:

Commands given below resolved the issue for me. Listed and deleted local snapshot and it freed 230 GB on my machine.In step 2, you enter the date/time received from step 1.

$ tmutil listlocalsnapshots com.apple.TimeMachine.2019-01-28-143406   

$ tmutil deletelocalsnapshots 2019-01-28-143406  

$ tmutil listlocalsnapshots /

Make sure it shows no file