Sidebar

Recover disk space from mariaDB logs

0 votes
502 views
asked Apr 21, 2022 by daniel-d-7319 (270 points)
edited Apr 22, 2022 by daniel-d-7319
We are trying to recover hard disk space and found that there are two files in qie/mariadb that take over a gig of space.  The files are ib_logfile0 with a current date modified and an ib_logfile1 with a date modified of last year.  I don't have a lot of MariaDB experience and am assuming these are log files similar to those used by MSSQL.  I can't find any information regarding shrinking the logs and recovering the disk space.  Do you have any guidance?

1 Answer

0 votes

The ib_logfile{0/1} files are used by the MariaDB/MySQL engine for rolling back transactions that need to be reversed. 

The size of these files are dictated by the system variable innodb_log_file_size.  When the size is met MariaDB/MySQL will automatically remove old log entries to keep the file size within the limit specified in the configuration.  Just deleting these files will not fix the problem because as the database runs queries the log files will grow back to the current size.

You can view the current size configuration by running the following query:

show variables like 'innodb_log_file_size'

If you want to change this value you can change the my.ini file and add a line under the [mysqld] section:

innodb_log_file_size=???M

NOTE: This option can not be changed to something smaller than the current size of the log files, so if you want to make it smaller, you will first need to go through the process of removing the log files.

This stackoverflow questions has some answers regarding the removal of the log files.  In most cases, stopping the database service and removing the files is all that is needed, but if there are any dirty innodb pages that are not updated as part of the shutdown process and remain dirty after deleting the log files you will end up with a corrupted database and have to do a full reset.

Due to the risk of database corruption, we recomend that a backup is taken of the QIE configuration before trying this.  If you need to keep the message history, then you will want to do a full database dump so that if the database does get corrupted, you can restore you dump.

If you need help getting the backup of the QIE configuration, you can always contact Qvera support.

answered Apr 22, 2022 by ben-s-7515 (12,320 points)
...