Centos7 – Something filling up the disk space

Robert AndresenProgramming, Tutorials Leave a Comment

When a webserver uses 100% of the diskspace, there is not enough space to create a session in PHP. In other words people cannot login to your web-application.

I had some problems with the httpd logs (/var/log/httpd) over some time with one single webserver. The access log can take up to mulitple gigabytes. After deleting the logs, everything worked fine.

After three times of the log filling up the server, I decided I had to adjust logging in the apache config.

See this link for more useful commands: http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/

Today something else filled up the disk

… and the httpd logs was empty!

The df -h command shows that 99% of the disk space was in use.

[root@webserver02 /]# <strong>df -h </strong>

Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 35G 33G 426M 99% /

 

But when checking the whole system from /, there was only 4.4 GB in use.

[root@webserver02 /]# <strong>du -h -s -x /</strong>
4.4G /

Where is the last 28,6 GB?

I found this topic on stackexchange, claiming the disk space is filling up by the kernel log. Related to a bug submitted back in 2008.

 

Solution:

I did a quick restart of the server first and it looks like the dmesg was flushed on the restart. If this was really the problem… For all the disk space went back to normal after the restart.

[root@webserver02 robert]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 35G 4.7G 28G 15% /
[root@webserver02 robert]# <strong>du -s -h /*</strong>
0 /bin
133M /boot
0 /dev
29M /etc
92K /home
0 /lib
0 /lib64
16K /lost+found
4.0K /media
4.0K /mnt
4.0K /opt
0 /proc
4.0M /root
8.0M /run
0 /sbin
4.0K /srv
0 /sys
340K /tmp
1.9G /usr
2.6G /var

 

Update 18.03.2016:

This problem occurred on another Centos7-server today. The mariadb-slow log was huge, so I deleted it. According to df -h44G is used on the disk, but with du -h -s -x /, it’s only 9.6G that are used.