0

I'm trying to figure out where my HD space is going. df tells me this:

bash-3.2$ df -h /
Filesystem   Size   Used  Avail Capacity  iused   ifree %iused  Mounted on
/dev/disk1  148Gi  137Gi   11Gi    93% 35980809 2791381   93%   /

The basic information here is correct. My disk is 160GB in log10 (1000) units, which is 148GB in log2 (1024) units. df -h on Mac returns log2 units, so the information is correct. OK, so, 137GB is used in log2 units. Where? Let's use du:

bash-3.2$ sudo du -d 1 -h /
Password:
1.0G    /.DocumentRevisions-V100
 40M    /.fseventsd
2.7G    /.Spotlight-V100
  0B    /.Trashes
  0B    /.vol
 33G    /Applications
2.3M    /bin
  0B    /cores
  0B    /Datarescue
4.5K    /dev
1.0K    /home
 15M    /Incompatible Software
8.3G    /Library
  0B    /lost+found
1.0K    /net
  0B    /Network
7.3G    /opt
 15M    /Payloads
8.3G    /private
1.1M    /sbin
6.0G    /System
 60G    /Users
1.1G    /usr
4.0K    /Volumes
128G    /

du -h is using log2 units also. And so, you'll probably see my issue: there's 9GB missing here (128GB is actually used, but 137GB is reported as used). How do I figure out where that's gone off to?

(I see this question repeated several times in the past, the issue there is typically that people didn't run du as root so it didn't include some files, and that was reported on stderr - but I clearly did run as root, and no errors about unreadable files were reported on stderr.)

[edit]

To clarify from the below response, I fixed this by using "sudo gdu --apparent-size -h -d 1 /" instead of "sudo du -d 1 -h /", and now it properly reports 139GB used, which is close enough to 137/148 as reported by df.

1
  • I had a discrepancy of 125 Gb (du said 740 Gb while df said 875 Gb) which vanished after performing a minor macOS software update. Pretty strange.
    – mvds
    Jan 26 at 19:58

2 Answers 2

1

I think in your case it may be as simple as df reporting in Gibibyte while du -h reports in Gigabyte unless you replace -h by --si.

E.g.

> du -s -h
303G
> du -s --si
326G
3
  • df -H (in 1000-units) reports 147/158GB used, and df -h (in 1024-units) reports 137/148GiB being used. Neither of these two is remotely close to 128GB, which is what du reports, and which is in 1024-units (according to man du). Nov 12, 2015 at 16:00
  • 1
    @RonaldS.Bultje In this case, you should also consider du's --apparent-size option.
    – Run CMD
    Nov 12, 2015 at 16:04
  • Ah! Yes, that made a big difference, so on Mac that's actually "gdu --apparent-size -h /" (du doesn't have that option), but now the sum is indeed 139GB. Thank you! Nov 12, 2015 at 16:23
0

Came across this one. I used ncdu utility on ubuntu, but you can install it on mac as well.

https://apple.stackexchange.com/questions/173767/terminal-command-ncdu

This should give you the option to see both size and apparent size.

Also, keep in mind that there might be deleted files which "still exist", i.e., you can find them with

lsof | grep deleted

(https://access.redhat.com/solutions/2316)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .