Possible alternative solution to MySQL error 28 on Rails
Mysql2::Error: Got error 28 from storage engine
is not actually an error in MySQL but is an error reported by the OS to MySQL and then forwarded to Rails. It is an OS error. Sidenote: this would be error 1030 from MySQL as per MySQL docs.
Error 28 on Linux means storage is full.
Most obvious solution is to check df -u
and see if the disk really is full. On staging environments it’s happened that log_rotate
was not set up and logs grew to gigabytes. Both the application and server logs should be checked.
A less obvious solution is to check df -i
which inodes usage. Inodes as basically references to files and directories but there is a limit on how many there can be and it is possible to run out of them.
Now, of course, I figured this out because we ran out of them on a staging server recently and it was because of the tmp/cache
directory because we were using file caching. Having had thousands of tests run against this server with many versions of each of the fragments cached resulted in the tmp/cache
directory using up all the inodes.
Deleting it freed up some 50% of them and we were no longer getting the error.