I'm running a webserver on CentOS.
Today I couldn't run any SQL queries. Upon investigation, error 28
, my /tmp
directory couldn't be written to.
I ran du /tmp
and it was 1.8Gb. I then ran find /tmp -type f -mtime +8 -exec rm -f {} \;
which freed up 300Mb space.
For now, this has done the job – MySQL can operate again.
However, I'm curious as to why the server has so many files in its /tmp
directory. I've restarted the server twice and the directory size has remained the same. Don't most linux distributions clear the temp files on reboot?
If I run ls /tmp
, I get a massive list of this type of file:
tempCaa7Nw tempk7uZU4 temps3GaF1 tempzzWWjV
tempcAbH5o tempK7VCdu temps3hRWv tempZzXHPM
tempCabZXR tempk7VwjK temps3IdYj tempzzxZWw
tempcAcQtu tempk7W0SI tempS3IGMF tempzZy7FM
tempCaCTkx tempk7xrzw tempS3iMfj tempzZy8L6
tempcAcur7 tempk7yX3J tempS3izd5 tempZZYKXr
tempcaCwnz tempk81EIE tempS3JU5s tempzZyQLO
tempcAdpAk tempk81Qpo tempS3kaNx tempzZZos7
tempCaeFae tempk81ZLV tempS3KYOx
tempcaEGmt tempk83VVy tempS3LI1u
Full list here.
Do I need to find out what's causing so many temporary files? Or do I simply need to increase the size (or something?) of my /tmp
directory? Is that in a config file somewhere?
I'm a poor linux administrator, so please excuse my ignorance.
EDIT for @JeffFerland
Here's the results of grep /tmp
on the lsof
output file.
mysqld 4649 mysql 4u REG 7,0 0 103774 / tmp/ib4mpAJ8 (deleted)
mysqld 4649 mysql 5u REG 7,0 0 103775 / tmp/ibvE7FxN (deleted)
mysqld 4649 mysql 6u REG 7,0 0 103776 / tmp/ibPe3Lls (deleted)
mysqld 4649 mysql 7u REG 7,0 0 103777 / tmp/ib656Kb7 (deleted)
mysqld 4649 mysql 11u REG 7,0 0 103778 / tmp/ibpptQzP (deleted)
cp 7997 root 3r REG 7,0 18897 28260 / tmp/tempF091j1
cp 7997 root 4w REG 9,1 0 297690 / tmp_bu/tmp/tempF091j1 (deleted)
ADDITIONAL EDIT
Having deleted ~300Mb of files yesterday, my /tmp
directory is back to its original size of 1.8Gb, and once again, MySQL isn't working correctly.
Please help!
Best Answer
Most of these file have the same size. Check what's in one of them. My first guess would be that your server accepts file uploads and doesn't clean up if you don't use the uploaded files.