Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I noticed that one of my servers was running out of disk space, due to heavy MySQL usage. I stopped everything using the database, freed up some space and restarted mysqld.

Now, I checked my table with CHECK TABLE table and it gave me this:

+-------------------+-------+----------+---------------------------------------------------------------+
| Table             | Op    | Msg_type | Msg_text                                                      |
+-------------------+-------+----------+---------------------------------------------------------------+
| db.table | check | warning  | Table is marked as crashed and last repair failed             |
| db.table | check | warning  | 1 client is using or hasn't closed the table properly         |
| db.table | check | warning  | Size of indexfile is: 8656211968      Should be: 1024         |
| db.table | check | error    | Size of datafile is: 3068555264         Should be: 3068558490 |
| db.table | check | error    | Corrupt                                                       |
+-------------------+-------+----------+---------------------------------------------------------------+

How can I fix that? Simply running "REPAIR TABLE" does not work, I tried that and it never finished (killed it after 18 hours). How can I save the data?

share|improve this question

1 Answer 1

Your table(s) have crashed. This happens with non-transactional databases such as MyISAM. Consider a move to InnoDB if you don't need fulltext search.

Anways - you have to repair it, there is no way around. Try the following in a shell to repair all your tables:

#myisamchk --force --fast --update-state /path/to/your/database/*.MYI
share|improve this answer
    
That's only going to work, if there is at least double the disk space of my table. But there isn't. I guess I have to copy the whole database to another machine and then repair it. –  s1ck Jan 31 '13 at 13:35
    
You can just copy the required table files (table_name.*) instead of copying whole database. Due to space your previous attempt was not successfull. –  mwasif Feb 1 '13 at 6:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.