Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I deleted a 2.3GB log file on my Ubuntu server, and df doesn't seem to be picking up the change. Is there typically a delay before df can detect that a large file has been deleted?

share|improve this question
add comment

4 Answers 4

up vote 10 down vote accepted

It sounds like the file is still open by some process. You'll need to restart that service for the disk space to be freed.

share|improve this answer
1  
Particularly likely to be true for log files. Many programs open their log filse when they start and don't close them until exit. –  mattdm Feb 1 '11 at 4:19
1  
And you can find out if it's still in use and by whom using lsof –  Joris Feb 1 '11 at 6:00
    
Great question and great answer. I've been wondering this for some time now. Also, you may be able to get it to close its file handle by sending it a SIGHUP. For example, if process 12345 has a "deleted" file open, then sudo kill -HUP 12345 may get that process to close it. (It depends, of course, on how that process handles a SIGHUP signal. But lots of daemon oriented files will close and reopen file handles when they receive a SIGHUP.) –  mehaase Sep 18 '12 at 18:56
add comment

Not long. Chances are high that the file is simply still being used. There won't be disk space release till you terminate corresponding process(es).

share|improve this answer
add comment

If the filesystem was out of space you could be running into the reserved space on the filesystem. The ext2/3/4 filesystems have some reserved space set aside for root. By default this is 5%. So if it was full and 2.3GB is less than 5% of the space on the drive the filesystem will still appear to be full.

In this situation you have two choices. To continue to free up space to the point that you have usable free space or modify the amount of space the filesystem has reserved. To modify the amount of reserved space use the tune2fs -m 0 /dev/sda1 replacing the 0 with the percentage of reserved space you wish to have and /dev/sda1 with the appropriate device.

See the accepted answer to this question for more details.

share|improve this answer
add comment

Also check your .trash directory.

share|improve this answer
add comment

Your Answer

 
discard

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.