Home > Archive > Sun Solaris > August 2002 > How do I empty a log on /var?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How do I empty a log on /var?
jtaubman

2002-07-16, 3:05 pm

My /var/mail directory is at 73%, I tried compressing the largest files, root and uucp, but it didn't change the 73% capacity. I remeber using /dev/null in a command to clear entries before.

Can someone give me some tips on how to safely empty the mail logs for root and uucp to reduce /var/mail capacity from 73%?
spoofy

2002-07-18, 8:44 am

if you compressed the files and it didnt change the 73% then those files are not your problem ...or they may be and your not deleting the orginal log file after you compress it. do a du -k and pipe the output to the sort command to see what is taking up the most space on that partition.
sheumack

2002-08-14, 8:24 am

Disclaimer: Don't do this on a production system unless you understand the consequences.

I think the command you are looking for is

cat /dev/null > filename.log

If an process has a file open through a file handle, compressing the file won't clear the space. Disk space is only freed when all filehandles are released. These may be entries in a file system (inodes) or held in memory.

When you compress a file, a compressed copy is made, then the original file is deleted. Thus the inode of the compressed file is different to that of the original file. No matter what you do to the compressed file, the space won't be freed.

By catting /dev/null to it, you preserve the file handle, so the space is released.

Make sure you don't need the file contents. Back it up to tape if unsure.

If you've already compressed the file, kill and restart the daemon that is writing the log.

HTH
Matt
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net