3

We've been working to clean up some space in our /opt mount. A large culprit of space consumption was log files for some processes we run (to the tune of 2 to 12 GB each).

We've cleaned these up by truncating them. However, this seems to be skewing our output from df -H.

/dev/mapper/Sys-opt 76G 72G 0 100% /opt 

When running du -sh * on this directory, the sizes don't add up. When running lsof | grep log, I see that many of the files we've deleted still show up with (deleted) appended to the end.

My question is, (a) should I be concerned with this?, and (b) is there a way to get my df -H back to normal, without restarting the box / these processes? Will restarting the processes even fix it (I see several entries for the same logs, which are from processes I know have been restarted recently)?

1

1 Answer 1

7

Unix uses reference counting to figure out whether a file is in use or if the data can be deleted/reused.

An open filehandle counts as a reference - so until it is closed, this space will be occupied. Restarting the process with the open filehandle will close the filehandle, and if it has been removed from the directory structure, it'll therefore disappear when it's ref count drops to zero.

So yes - restarting your process will make that file vanish.

This can happen with overly verbose logging from a daemon - it's still writing to it's log file, despite some well intentioned individuals having a clearout.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.