Large disk usage difference between two MariaDB servers with similar data
3
votes
0
answers
64
views
I'm trying to understand a significant discrepancy in disk usage between two MariaDB servers that are hosting the same application and (apparently) the same data. The two servers are entirely separate and unrelated.
When I run
df -h
to check disk usage:
Server 1: ~60G used
Server 2: ~400G used
To investigate further, I ran the following SQL query to check the size of each database:
SELECT
table_schema AS "Database",
SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)"
FROM
information_schema.tables
GROUP BY
table_schema;
Results:
Server 1:
| Database | Size (MB) |
| -------- | -------------- |
| information_schema| 0.20302000 |
| mysql| 19.2345678|
| performance_schema| 0.00000000|
| myDB| 7153.45673428|
| sys| 0.03561897|
Server 2:
| Database | Size (MB) |
| -------- | -------------- |
| information_schema| 0.20908965|
| mysql| 21.45678765|
| performance_schema| 0.00000000|
| myDB| 8232.56789542|
| sys| 0.03848632|
As you can see, the actual data size is relatively close, yet the disk usage reported by df -h
is vastly different.
datadir in my.cnf
points to the same location on both servers: /path/to/data
Both servers are running the same MariaDB version (**11.4.2**) and have a similar setup. Running on a Red Hat 9.5
When I run SHOW variables LIKE 'log_bin%';
| Variable_name| Value |
| -------- | -------------- |
| log_bin| ON|
| log_bin_basename| /path/to/data/mysqld-bin|
| log_bin_compress| OFF|
| log_bin_compress_min_len| 256|
| log_bin_index| /path/to/binlog/log_bin.index|
| log_bin_trust_function_creators| ON|
When I run SHOW variables LIKE 'expire_logs_days%';
| Variable_name| Value |
| -------- | -------------- |
| expire_logs_days| 3.000000|
and if I run ls -lhr /path/to/data/mysqld-bin*
Engine used -> InnoDB
If I run :
du -ch /path/to/data/mysqld-bin*
It gives me like 370G.
I can see the most oldest files is 6 Mar. I think binlog files arn't properly purged.
What else could be taking up disk space in /path/to/data
that's not reflected in information_schema.tables
? What should I check next to troubleshoot this?
Asked by executable
(187 rep)
Jun 13, 2025, 08:47 AM
Last activity: Jun 13, 2025, 12:29 PM
Last activity: Jun 13, 2025, 12:29 PM