Alex Rivera | Logout

rm not freeing diskspace

Asked 2008-12-01T23:54:55.727
51

I've rm'ed a 2.5gb log file - but it doesn't seemed to have freed any space.

I did:

rm /opt/tomcat/logs/catalina.out

then this:

df -hT

and df reported my /opt mount still at 100% used.

Any suggestions?

Edit
Report

1 Answer

6

As FerranB and Paul Tomblin have noted on this thread, the file is in use and the disk space won't be freed until the file is closed.

The problem is that you can't signal the Catalina process to close catalina.out, because the file handle isn't under control of the java process. It was opened by shell I/O redirection in catalina.sh when you started up Tomcat. Only by terminating the Catalina process can that file handle be closed.

There are two solutions to prevent this in the future:

  • Don't allow output from Tomcat apps to go into catalina.out. Instead use the swallowOutput property, and configure log channels for output. Logs managed by log4j can be rotated without restarting the Catalina process.

  • Modify catalina.sh to pipe output to cronolog instead of simply redirecting to catalina.out. That way cronolog will rotate logs for you.

answered 2008-12-02T00:09:12.343

Your Answer