buy tb500

How do I clear a full partition? or logs

There are a few possible solutions.

Usually, /var is what fills up first. This is because /var holds all the system logs.

To see what directory or log is taking up all the room, start at the base. Issue the following commands from a terminal session:

  1. cd /var
  2. du -sh *

This will show how much space is used and available in each directory, as well as the file sizes of each file in the current directory. Examine the command’s output. Once you see what directory is taking up all the space, cd to it and type the same command again. Follow this searching pattern until you find the files taking up the space.

Once found, you can either delete the files or, if you’d like to save some of the most recent entries to it, you can type this:

  1. tail -5000 filename >
  2. mv filename
  3. sync

This will copy the last 5000 lines from the file to a temporary file. Now you probably want to restart whatever service it is that created the file, to release its file lock.

The /usr directory also fills up sometimes, because of Apache. The first thing you should look at is usually the Apache logs.

  1. cd /usr/local/apache
  2. du -sh *

You will likely find that the logs/error_log or logs/access_log files are very large. At this point, you are free to delete them or use the tail trick above.


Leave a Reply