Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

df returns incorrect disk usage.

Status
Not open for further replies.

linuxMaestro

Instructor
Jan 12, 2004
183
US
/dev/sda5 2.9G 2.7G 84M 97% /usr
if there is only 2.7 of 2.9 used, then there should be 200M available, but it only shows 84M

Also, when I do du -sh * it says I'm only using 1.2G, why does df say 2.7?
root@lrm103 [/usr]# du -sh *
33M X11R6
88k aquota.user
97M bin
4.0k dict
76k doc
8.0k etc
8.0k games
24M include
80M java
3.2M kerberos
330M lib
320k libexec
361M local
16k lost+found
15M man
28k quota.user
15M sbin
303M share
52k src
0 tmp
0 usr
 
You run into two potential "math"-related issues..

One is that there has always been a debate as to whether a "megabyte" (impacting computations of gigabytes) is computed by dividing by 1,000,000 or 1,024,000 or 1,048,000 - a debate I will not enter here, but be aware that not every application reporting free space is talking about the same metric.

The other, highly confusing, element of the picture is how the EXT3 file system utilizes disk space for journalling. I presume that this is a factor in your situation. You may very well have ~2GB of data, but you might also have a very large chunk of journal space allocated - not that you can control it, it just happens.

You may also find that the "smart" elements of the drive hardware have found bad sectors/clusters and have taken steps to remove them from use by the file system. I'm not sure how linux would resolve this in the displays you are viewing, but it could very well be that "bad space" + "used file space" + "journal space"="total space used reported" - along with the challenges of computing megabytes as I mentioned earlier.

It's most likely correct.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top