Mysql – ibdata1 corrupted, recover from ib_logfile

innodbMySQLrecoveryrestore

A failing hard drive have left me with a corrupted ibdata1 file. I know where the file starts but not where it ends. The hard drive recovery software claims the file is larger than the hard drive itself, leaving me to the conclusion that I can't trust the integrity of the file at all.

The .frm and ib_logfile0 and ib_logfile1 files are safe and sound, though.

Is it possible to recreate the table data from the ib_logfile[0,1] files, or should I cut my losses?

Best Answer

ib_logfile-s store only recent changes, so you won't recover all data from them.

It's possible however to fetch records directly from disk image, you don't need to restore ibdata1. Actually you even don't need a filesystem.

Check out data recovery toolkit from http://www.percona.com/software/mysql-innodb-data-recovery-tools .

You need something like

./page_parser -f disk.img

And then you can fetch records from InnoDB indexes.

UPDATE: Data recovery toolkit moved to GitHub