I don't get where my linux space is gone.

when i run df -h, it shows used 15 GB of total 20 GB

when I run ncdu program, to find what takes, I do sudo ncdu in my root directory. And I see sorted by size directories:

4.7GB home
4.5GB var
1.3 GB usr

and later is 19 MB lib and so on

so adding up - the space is 4.7+4.5+1.3 = 10.5. OK plus those small directoreis lets roudn to 11 GB used. So where are my 4 GB then?

Recommended Answers

All 13 Replies

Be sure that you do not have any hidden files, coz those hidden files tend to eat up hard disk space without your knowledge.

It could also be that it's actually just a mathematical problem with the computer. You see, most people view 1 GB as 1000 MB. In reality, it's 1024 (computers do everything in binary, which is powers of 2). This 24 mb adds up with each GB. And really, if you look at it that way it's even larger. Basically, the right click on the drive telling you the specs and the space are calculated as 1000mb per Gb. It's not gone, just not showing it to you correctly.

That in conjunction with the MBR (master boot record) and the paging file plus the reserved space for the recycle bin can add up. The paging file can range anywhere from a couple hundred MB to a couple GB (depending on how big your filing system is). All that adds u [Sometimes].

hmm,then its interesting why ncdu would not include hidden files space. And btw probably thre is no recycle bin (I guess) because its without graphical enviroment, its only console. Its in anohter server.

And those MBR and paging file are also hidden?

Hidden files should be included in du output. I'm not familiar with ncdu, but I'm checking it out now!
What do you get from this command: sudo du -sh /


Linux automatically reserves about 10% of available space for root, so when users fill up the file system(s), the admin can still get things re-arranged (backups, remove old/stale files, etc).

Hidden files should be included in du output. I'm not familiar with ncdu, but I'm checking it out now!
What do you get from this command: sudo du -sh /

And I guess ncdu works based on du. Its just more user friendly. From that command I get:

sudo du -sh /
[sudo] password for darius:
du: cannot access `/proc/10549/task/10549/fd/4': No such file or directory
du: cannot access `/proc/10549/task/10549/fdinfo/4': No such file or directory
du: cannot access `/proc/10549/fd/4': No such file or directory
du: cannot access `/proc/10549/fdinfo/4': No such file or directory
11G     /


That's one of the first things I thought about (I used to work for a company that writes backup software and this came up a lot) so I researched it to refresh my memory. The filesystem (ext2, ext3, ext4) reserves about 5% for a buffer zone by default, which is nowhere near the 20ish percent that our OP is seeing.

This does come up a lot on larger filesystems. Since the default is 5%, you lose about 50GB on a 1TB partition, or 400GB on an 8TB partition. But 5% of 20GB is only 1GB. You usually notice the difference in the space remaining in your 'df' output, but 'du' output should be correct. I suspect that whats being reported is actually correct, but we aren't seeing all the numbers.



That's interesting! I'm stumped... Can we see the full 'df' output?

Can we see the full 'df' output?

you meant this or something more?

 df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/vzfs              20G   16G  4.8G  77% /

Oh! vzfs! Is this an OpenVZ or Virtuozzo virtual machine? If so, you may have a quota issue. Check out this thread: http://forum.openvz.org/index.php?t=msg&goto=35897&

The OP in that thread had a HUGE discrepancy between du and df output. The thread links to an article in the OpenVZ wiki which is pretty technical, but I think that's where the answer lies. If you are the administrator for the hardware node, you might want to check on the quota for the container. If not, you might want to check with your host and see if there's anything they can do to fix it.

I hope this helps!

Is this an OpenVZ or Virtuozzo virtual machine?

Don't know how to check

ANd I am not having access to hardware, its from some local company. So now not sure if to ask, this server is not important one, its testing server and I was told to make it not filling full. But still its not fun when you search what it takes space but cannot find.

Thanks for info :)

asked my coworker and found the problem :) he adviced to restart apache. Bercasue it does not let to empty the space. And most likely I was deleting those log files but they were actually not deleted. After restart, suddenly 5 GB more space :D

I have read somewhere about this, but did not think that it it will hold so much space with those locked files :)

Of course ncdu could be improved to show also the locked files which still take place, would have been easier to find.

Great, thanks for the follow-up! Glad you got it figured out :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.