var_lib_mysql_disk_space_filling_up.txt (878B)
Q:Your MariaDB instance suddenly starts filling /var/lib/mysql faster than usual. Disk usage keeps growing even though you aren’t importing new data or adding tables. What are the most common causes for unexpected data directory growth, and how would you investigate and reclaim space safely? A: -> Log rotation : easy to miss, but can bite into space on busy systems -> Slow query log : dumps a ridiculous amount of data on big/busy systems, so it's often kept off for that reason. -> Snapshots (ZFS) : stale snapshots are invisible to the DB but eat space on disk -> Script-based observation : cook up some script that does a xargs du -sh on files and look for any anomaly, take things from there depending on the results -> Binary logs : check `expire_log_days`, whether it's not set excessively high -> Tablespaces : .ibd files can get inflated, though not an easy fix