I'm not a habitual Mac user. I wanted to get a breakdown of disk usage on a Mac, so having installed ncdu
via homebrew ages ago, I did sudo ncdu -x /
. Realising it would take forever, I installed duc
with brew install duc
, set it to profile with sudo duc index -xpH /
. (Flags: -x
= don't cross filesystem boundaries, -H
= count hardlinks once, -p
= progress). This morning this 120GB Mac had managed to scan as much as 2TB. I killed the process and switched off WiFi, in case it had mounted the network drive, and tried again: same problem. I gave up and went back to ncdu
: same problem. I accepted defeat and installed some graphical app which seems to do the job.
Question: where is all this data coming from? I'm familiar with hardlinks being double counted, but both duc
can correct for that. I've never seen behaviour like this on any Linux system; clearly, the Mac filesystem model is very different. What's going on?
(I realise that part of what's going on is my naively trying to use Linux tools on a Mac. I've corrected that. But I want to know what's happening at the filesystem level because I've never seen this scale of a problem before: if you forget to exclude special paths in Linux you might get a few MB of nonsense (although most just fail); hardlinks can give you more than you wanted, but not by that order of magnitude. Clearly, macOS exposes a very different underlying model.)