2

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?

  • 1
    ib_logfile* contain only a certain amount of recent transactions (in case you are using innodb) they are supposed to restore RECENT data not the ibdata file in its entirety, if ibdata is corrupted best course of action would be to restore from backup. Also I believe such question is offtopic here and should be asked at ServerFault. – hidden_4003 May 21 '14 at 9:31
  • Agreeing to hidden_4003. Your best bet is a backup and binary log (if enabled). – tombom May 21 '14 at 9:32
4

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