Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Just had the message:

Low disk space.. 2 GB left

Judging by a posted message on ubuntu.org 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

2 Answers 2

up vote 5 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: [ubuntuforums.org/showthread.php?p=12148780#post12148780] 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

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.