Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ran du -hs to find out how big my /home/user directory was and it reported as 18G. I cleared out almost 4G of data and ran du -hs again to find out how much space I actually saved and it still reports as 18G. --apparent-size makes it report as 19G. What am I doing wrong?

share|improve this question
Did you "clear out" the filesystem by unlinking files that were in use at the time? – David Schwartz Jun 18 '12 at 20:40
up vote 3 down vote accepted

If the files are still in use, du will not update.

Here's a post with an exercise so you can see this in action : (for BSD, but it's equivalent in Linux)

share|improve this answer
df will do this but I don't think that du will follow this behavior. – mdpc Jun 18 '12 at 21:44
Goodness! What does this user have running to hold 4GB of files open? Wow! That's a lot of wedged zombies. (Ewww, mental image...) – lornix Jun 28 '12 at 5:11
@lornix: a DVD image perhaps, that was being played with VLC, mplayer etc. – Cristian Ciupitu Jun 29 '12 at 14:51

Another possibility that can cause this is filesystem compression and utilities that don't know about it. I saw this with ZFS a few years ago on Solaris but the theory should be the same for Ubuntu and any other filesystem that supports compression.

I created a file with mkfile 10g test. After this, ls -lh reported it as 10GB and du -h reported it as 0.

If the 4GB you cleared out was found with ls -lh then it might not have been taking up nearly as much space as it seemed.

share|improve this answer
Something similar can also happen with sparse files. dd if=/dev/zero of=test bs=10G seek=1 count=0 creates a file that ls -lh reports as having 10GBs. – Cristian Ciupitu Jun 18 '12 at 23:07

This could be caused by hard links which means that the files you deleted still exist under other names. To find them, run find -type f -links +1.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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