1

df -h shows:

df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ada0p2    1.9G    256M    1.5G    14%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ada0p4    804G     34G    706G     5%    /usr
/dev/ada0p5     93G    3.5G     82G     4%    /var

but, du -sh shows:

du -sh /var
3.5G    /var

Why? df is telling me i have no space out of the 93G but when i check the file size of the /var/ directory it amounts to 3.5G?

Can any one explain why this is please?

5
  • 3
    Please don't post images of text
    – cas
    Jul 23 '17 at 10:46
  • that does not answer my question! However I will note that rule next time!
    – Adamski
    Jul 23 '17 at 10:59
  • 2
    Don't confuse question comments with answers, and don't note the rule for next time. Edit and fix this question now, please.
    – JdeBP
    Jul 23 '17 at 11:31
  • removed images and pasted output.
    – Adamski
    Jul 23 '17 at 12:15
  • Thank you. Have you spotted that df is no longer doing what you said? (-: You actually have a more interesting question that is not quite a duplicate of the other question, because you had df showing you that even the free space reserved for the superuser had been taken (not the case in the other questions), and then showing you that it had come back.
    – JdeBP
    Jul 23 '17 at 12:25
0

First of all your question is very interesting in itself the df and du tools work differently in Linux

according to Linux man page

du - estimate file space usage

df - report file system disk space usage

df works on the file system level while du works on file level so if there are open file descriptors it will be reported by du but not df

1
  • Can you please upvote the answer as well thankyou
    – varnit
    Jul 25 '17 at 11:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.