HostOnNet Blog

InnoDB Error log file ib_logfile0 is of different size

After copying MySQL data (/var/lib/mysql) folder from one server to another, MariaDB failed to start.

> /var/log/mariadb/mariadb.log
systemctl start mariadb
cat /var/log/mariadb/mariadb.log

On checking log, found following error

InnoDB: Error: log file ./ib_logfile0 is of different size 0 268435456 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
InnoDB: Possible causes for this error:
 (a) Incorrect log file is used or log file size is changed
 (b) In case default size is used this log file is from 10.0
 (c) Log file is corrupted or there was not enough disk space
 In case (b) you need to set innodb_log_file_size = 48M

This was InnoDB log file size on old server was different from default size.

On checking old server, i found the size of innodb_log_file_size set to 256M. Editing /etc/my.cnf on new server and adding following under [mysqld] fixed the issue.

innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 2G
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120

Other innodb values are same as old server to be safe.

Posted in MySQL