List:General Discussion« Previous MessageNext Message »
From:Traiano Welcome Date:June 15 2012 2:49pm
Subject:MySQL Data Recovery on Linux from files recovered to lost+found
View as plain text  
Hi List

 I have (had) a mysql database running on a linux server which crashed
and suffered e2fsck file system corruption. I applied the e2fsck
filesystem checker, which recovered what appears to be most  of the
files comprising the data, storing them in the  "lost+found"
directory. This looks something like:

[root@vm-rec lost+found]# ls -l | head

-rw-r--r--  1 root    root            163 Jul 16  2009 #1442435
-rw-------  1 root    root           1753 Mar 27  2011 #1442436
-rw-------  1 root    root            481 Jul 12  2011 #1442437
-rw-r--r--  1 root    root             47 Jul 12  2011 #1442438
-rw-r-----  1 root    root            646 Aug 21  2010 #1442439
-rw-r--r--  1 root    root            486 Nov 12  2010 #1442441

So, the names of these files are lost and we are left only with their
contents, which seems intact. I can distinguish all the files that
would have been part of a MySQL DB, e.g, if I use the linux "file"
utility on each file, I get:

---
.
.
.

#2474833: MySQL table definition file Version 10

#2474834: MySQL MISAM compressed data file Version 1
#2474836: MySQL table definition file Version 10
#2474839: MySQL MISAM compressed data file Version 1
#2474841: MySQL table definition file Version 10
#2474842: MySQL MISAM compressed data file Version 1
.
.
.
---

... etc ...

Also, if I extract the "ascii" content of one of the "MySQL table
definition file" using the linux strings utility, I seem to be able to
distinguish the MySQL schema of a table in the database. e.g:


---
[root@vm-rec quarrantine]# strings \#2475839
PRIMARY
FK3AB9A8B2CDB30B3D
InnoDB
)
timeslot_id
attendee_user_id
        comments
signup_site_id
calendar_event_id
calendar_id
list_index
timeslot_id
attendee_user_id
comments
signup_site_id
calendar_event_id
calendar_id
list_index
---


Using these strings as keywords, searching through a copy of the
original schema which I have reveals that the file seems to contain
exactly the schema of a known table:


---
CREATE TABLE `signup_ts_attendees` (
  `timeslot_id` bigint(20) NOT NULL,
  `attendee_user_id` varchar(255) NOT NULL,
  `comments` text,
  `signup_site_id` varchar(255) NOT NULL,
  `calendar_event_id` varchar(255) DEFAULT NULL,
  `calendar_id` varchar(255) DEFAULT NULL,
  `list_index` int(11) NOT NULL,
  PRIMARY KEY (`timeslot_id`,`list_index`),
  KEY `FKBAB08100CDB30B3D` (`timeslot_id`),
  CONSTRAINT `FKBAB08100CDB30B3D` FOREIGN KEY (`timeslot_id`)
REFERENCES `signup_ts` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
---

So it would seem that there might be some way to map these files back
to a format with which I can reconstruct the original database ...

My question is: Does any one have any recommendations of a process I
could use to do this effectively ?


Many Thanks in advance
Traiano Welcome

---
Thread
MySQL Data Recovery on Linux from files recovered to lost+foundTraiano Welcome15 Jun