List:Internals« Previous MessageNext Message »
From:Ingo Strüwing Date:June 19 2007 11:23am
Subject:Re: Recovering MySQL Server 4 Data from crashed Harddrive
View as plain text  
Hi Daniel,

Daniel Rindt wrote:
> Am Montag, 18. Juni 2007 12:50 schrieb Martin Friebe:
...
> i had here a dump from the tables and her structures. so i can read in the 
> dump and can mysqld recreate the frm files. then i only need the myd files 
> wich contain the data, the index is in my opinion  not required instead of 
> mysql really need it. (possibly that mysql can rebuild it self?)

REPAIR TABLE ... USE_FRM

But you need exactly the same MySQL version that was used to create the
table or did the last ALTER TABLE, REPAIR TABLE, or OPTIMIZE TABLE on it
respectively.

>> Another possibility is trying to recover the index (MYI) file, it
>> contains pointers into the MYD file:
>> variable length => position in pyte
>> fixed length => record no (pos = record_no * record_len)

It depends on what you have. If you have just a sea of sectors, you're
probably lost. If you have lost+found files with names like found000001,
found000002, ..., then you "just" need to find out which file is the
.MYI or .MYD of which table. The table name is not included in the
files. .MYD has no header nor footer. MYI has a header, which does also
contain the size of the belonging MYD. This could give you a chance to
match the files. Even though that size may not be accurate if there was
a crash, it could help to make the best matches.

If you can find all .MYI file by their headers, myisamchk -vvv can show
you the layout of the table (columns + indexes). This may help to guess
which table it belongs to.

...
>> The index also holds duplication of some of the data. So once you have
>> the index, you can extract the data + position, and search this info on
>> the remaining sectors.
> i must write a tool for doing this job i guess?

Yes. :-(

> The binlog is another way to recover somthing?

Yes. If you have a backup and a contiguous binlog starting at or
including the backup time.

> but what you not should forget i must first extract from a collon of data 80gb 
> these files, so i first should find the files by header or footer. 

MyISAM data files do not have a header of footer whatsoever. The only
exception are compressed tables.

Regards
Ingo
-- 
Ingo Strüwing, Senior Software Developer
MySQL GmbH, Radlkoferstr. 2, D-81373 München
Geschäftsführer: Kaj Arnö - HRB München 162140
Thread
Recovering MySQL Server 4 Data from crashed HarddriveDaniel Rindt18 Jun
  • Re: Recovering MySQL Server 4 Data from crashed HarddriveMartin Friebe18 Jun
    • Re: Recovering MySQL Server 4 Data from crashed HarddriveDaniel Rindt18 Jun
      • Re: Recovering MySQL Server 4 Data from crashed HarddriveIngo Strüwing19 Jun