Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Just had the message:

Low disk space.. 2 GB left

Judging by a posted message on forums, I found that I have a .log file in /var/log at 22 GB in size!! My root is an 82 GB partion and Disk Analyser shows the offender to be in log. The system root was installed circa 8 months ago, so clearly this is not a good thing in creating a 22 GB log on an 82 GB root partition.

Is it safe to delete the log file or please advise on the correct safe procedure to cleanse it without messing up my system. I presume it may be ok, but would like some other opinions before I do the task of delete.

share|improve this question
An alternative is to compress it using gzip or bzip2 -- though this requires temporarily having enough space to hold both uncompressed and compressed copies of the file. Log files tend to have a lot of redundancy, so they should compress quite well (probably better than 90%). – Keith Thompson Aug 3 '12 at 22:11
up vote 8 down vote accepted

It is generally safe to delete log files. The only disadvantage associated with doing so is that you may not be able to examine the log, if you're troubleshooting some other problem later. Since new logs are automatically generated, even this disadvantage is short-lived.

Most logs are deleted automatically (after being rotated by compression and renaming, and kept a while in that archived format). If you have a log that's expanded faster than Ubuntu is deleting it, it's unlikely that you'll experience any problems from deleting it manually.

However, if you have a log file that's 22 gigs in size, something very strange is happening, and it would be worthwhile to investigate that. I recommend editing your question again to include a link to the Ubuntu Forums thread you're talking about, and also to include the full name of the 22 GB log file.

share|improve this answer
Thanks for the advice. I have now found out the offending log file is a "mail.log". Here is the link to the Ubuntu forum: [] Readers will notice in the screenshot 3 large log files, (sys, mail, mail.err). I hope this helps anyone with a similar issue with root space loss. – Paul B Aug 3 '12 at 21:06
I now have 60Gb free space after deleting the offending .log files. Please refer to the ubuntu forum above. Thanks to Eliah for highlighting the issue and answering my post. – Paul B Aug 3 '12 at 21:37

Further to my original post, I found it easier to use BleachBit (on Root) to clear out all the old logs on my Ubuntu 12.10 desktop; why they get so large I still don't know, but for now BleachBit 'clears all known bits, DEAD!' I reclaimed over 1.6Gig in space. if you find similar log, problems, then check out the BleachBit utility from the Ubuntu Software Resource or Synaptic Package Manager.

share|improve this answer

I'd like to add a word of caution here - maybe you can delete all your log files, but you might have problems if you delete the /var/log subdirectories. I deleted all my log files and their directories (rm -r /var/log/*) and it broke my apache2 functionality. Apparently apache doesn't/can't recreate the log directories and therefore can't write log files and that apparently can cause it to fail.

I've heard before that deleting some log files can cause problems, though I don't have any first-hand experience to support it. But of course I didn't have any first-hand experience of directory deletion being a problem until a few days ago...

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.