[plug] How to trim down the size of /var files

Anthony J. Breeds-Taurima tony at cantech.net.au
Tue Aug 20 09:09:43 WST 2002


On Mon, 19 Aug 2002, Steege, Phil E wrote:

> When I originally installed my redhat 7.3 system I set /var on its own 500Mb
> partition, just in case I got a lot of error messages, so it would not
> overflow my system.
> Lately, due to much 'tinkering' with the system I generated a lot of error
> messages and the /var partition was getting above 90% of space used.
> I was able to delete and trim some of the files, such as messages,
> messages.1, messages.2....etc.

If you don't care about the meesages generated by your machine covered in
those date, then there will be no issues with deleteing and of the
messages.[0-9] files

> My lastlog file is very large now.  It is a data file and I do not know if I
> can just delete it.  Will the system re-create the lastlog file
> automatically?

Just cat /dev/null > lastlog, shoulddo it.

> Also the wtmp is getting bigger.  How can those 'data' files be trimmed when
> they become too large?

cp -a utmp utmp.back
cat /dev/null > utmp
# optionally
gzip -9 utmp.back

Having said all that, look into logrotate.

on my RedHat 6.1 system /etc/logrotate.conf says:
/var/log/lastlog {
    monthly
    rotate 12
}

That could easily be changed to:
/var/log/lastlog {
    daily
    rotate 1
}

Then you're only ever keeping todays and yesterdays lastlogs around.

Most packages should install there logrotate setup in: /etc/logrotate.d/

HTH

Yours Tony

   Jan 22-25 2003           Linux.Conf.AU            http://linux.conf.au/
		  The Australian Linux Technical Conference!



More information about the plug mailing list