Super User is a question and answer site for computer enthusiasts and power users. 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 have a ubuntu server with smbd ftp and a http server. For some reason the freedisk space will go from 2 gb down to 0 bytes as time goes on (usually a couple of days). However once i reboot, the disk space jumps back up.

What is the problem?

share|improve this question
You are probably collecting large log files. Check /var/log and /tmp. – terdon Mar 5 '13 at 22:26
So when you reboot, the log files get deleted? And also how would one manage these logs? Is there any way to have them deleted after a certain period (like a cron job to delete all the .gz) or is there a more streamlined config file that controls the amount logged etc? Also is it safe to delete the contents of the entire log directory? – agz Mar 5 '13 at 22:40
First find out which logs are causing the problem. Then you can deal with the offending application. – terdon Mar 6 '13 at 0:12
up vote 0 down vote accepted

The problem will probably be the /tmp directory is filling up - rebooting clears this directory out. You may want to have a look in it and see what files are created (session cookies ?) and then target the program that is creating the offending file(s).

You can delete these files periodically though Cron, however it may not be a good idea to do it if the program that relies on it is still running - that will, of-course, depend entirely on the program.

(Technically its possible to delete the files using 1 liner in CRON - I don't recommend it, but something like the following might work, with some tweeking)

0 * * * *    find /tmp -ctime +1 -name "offendingfiles.*" -exec rm {} +

This will find any files which match "offendingfiles.*" in the /tmp directory greater then 1 day old and remove them.

A better way for handling log files - if that is where the problem lies, which I think is a bit unlikely, would be to modify the rotation, compression and deletion of the files (edit /etc/logrotate.conf and/or /etc/logrotate.d/*)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .