One of the MySQL servers I help manage was encountering some problems with a full data directory. It was a bit mysterious, because we couldn’t find any files to account for the increased usage. Here are some things we checked:
- A recursive
ls -ldidn’t show any more, or larger, files than usual. - Using
lsofand looking at the SIZE column didn’t either. - There were not enough temporary files or tables open (as
shown by
lsof) to account for the disk space.
Oddly, someone discovered that FLUSH TABLES would drop disk usage by about 15GB in a fraction of a second, allowing the server to continue running without problems.
I carefully measured all of the items in the above list before
and after FLUSH TABLES. No doubt about it: no files went away, no
files shrank, yet df and du showed the
difference in the space free and …