Meow Meow
Meow Meow

Reputation: 666

Discrepancy between df -h and ll -h returned information

everyone! df -h shows that a disk is full (used 100%). But when I use ll -htotal size of files almost 2%. Can someone explain what happens?

Upvotes: 0

Views: 165

Answers (1)

Erki Aring
Erki Aring

Reputation: 2096

There are two main reasons for that:

  1. In Linux, you can delete a file even when it is opened by someone else (some program, for example). This is because, when you delete a file, only filesystem reference to this file is removed, the actual file itself is removed (and disk space is freed) only when all the users have closed this file. ls cannot see files that are deleted but still in use.
  2. Almost all filesystems arrange their data in blocks, usually 4Kbytes. That means, when you create a small file, the actual disk space used is still at least 4K. When you have a lot of small files, then this becomes significant.

Difference between ls and df comes from the fact, that one displays the size of the file contents while the other shows the actual disk space used.

Upvotes: 1

Related Questions