Memoir from quiet days at Rockhampton –
Ever faced a problem of an indefinite loop in a process that writes to a log file like mad? Worse still – you don’t know which process is writing to the file? Ok, even if you think life is simple and delete the file assuming disk space gets freed up?
I have felt a dog chasing its own tail while solving this problem in a production environment.
A simple ‘rm’ command may not necessarily free up disk space used by an ever growing file since the inode for the file [ which is a pointer to the disk ] may be still kept open by the process that is writing the data and disk space would not be freed.
Follow steps below
fuser -f <filename>
would list process ids that are still accessing the file. These process ids must be killed.
cp /dev/null > <filename>
would empty the file out and free up space. This reflects in inode as well!
Alternatively, on GNU Linux, simply
does the job equally well.