Ubuntu – After deleting log files, Ubuntu server still saying there is no space

Ubuntu

My Ubuntu server has stopped due to a lack of disk space. I deleted some log files which has grown huge very quickly. But df -h still shows I have no space left. When I run du -sh /* I can see that I should have plenty of disk space left after deleting the logs.

I ran lsof +L1 and it brought up two files: /var/log/mail.log and /var/log/mail.err. These are two logs I had deleted. I restarted apache, postfix and mysql (mysql wont restart because of lack of disk space, it think) but still df -h shows no space.

Best Answer

In this case the files are probably managed by syslog. You may have rsyslog, sysklogd or syslog-ng. From memory I think rsyslog is the default, so try:

sudo service rsyslog restart

This should release the files, and allow them to actually get cleaned up. Until the last filehandle closes, the filesystem can't free up space.

(or you could do like a Windows admin and just reboot of course...)