I have a mysql docker setup. The
/var/lib/mysql dir in the container is put on a volume. It is set up as a bind volume, so the volume is not handled by docker, but it is a directory on the host.
The host itself has 20GB disk space, the volume is on a different device with 50GB total space. The host has around 3GB free space, while the database is around 25GB with one particularly big table. (Should be around 15GB)
After deleting a few records, I wanted to run an “OPTIMIZE TABLE” mysql query on the big table.
Normally mysql starts to rebuild the table in a temporary disk table in the same directory, so it’s necessary to have as much free space on the device which the database is on, as the table.
But short after mysql starts to rebuild the table (the tmp table is only 0.5GB large) when the host runs out of space. When the query fails the space is freed up again.
What’s happenening here?
I could not figure out what’s eating up the space. If mysql did it (log something), it would probably not free up the space. The /tmp and /var/tmp dirs were empty.
Is this some kind of write buffering in docker?