« first day (2 days earlier)    last day (15 days later) » 

06:51
Awake.
Rebooting, be back later. Ping me please.
 
2 hours later…
09:03
Back. Was making backups.
09:31
@Fabby Hey!
I came to the point to import databases back.
Not sure how to access the /var/lib/mysql folder as it wasn't archived via tar because of permissions I assume.
How can I get access to it?
I have the partition clone.
I don't understand the question.
chown
root has access to everything
OK, trying in a moment
Right!
I can see the files.
Should I simply copy them and override the current ones from /var/lib/mysql?
:-) :-)
yup.
Copying... :)
Man... if that works... haha
Ha! The corrupted ones are only the ones belonging to the company I coillaborate with, haha
:D
09:37
I can request a snapshot at anytime from them.
My own data which is important seems to be fine.
ERROR 1018 (HY000): Can't read dir of './that_db/' (errno: 13 - Permission denied)
What permissions should I give...?
drwxr-x--- 2 root  root       4096 apr 23 12:36 doesn_t_work
drwxr-x--- 2 mysql mysql      4096 apr 23 12:38 works
# chown -R mysql:mysql /var/lib/mysql seems it fixed it
reading
yup
ERROR 1146 (42S02): Table 'that_db.thatColumn' doesn't exist
Is this because of corruption or I can do something?
I feel something is messed up because I copied the raw files, but have no idea what.
show tables works.
Now we're going deep into MySQL recovery, no more disk recovery.
Yes...
Are you familiar with MySQL?
I'd need to read up on the MySQL recovery docs.
you can get a copy you say?
09:43
Yes, the raw files seem to be fine.
The size of the db is 2GB
Yeah, 5 years ago was the last time I had to recover a MySQL DB
so if you can get a copy, that will save us a day of work...
to recover a database, I need its original structure
create new DB with correct structure,
copy data only, no indexes
(as much as possible)
rebuild indexes
rebuild triggers and constraints
Entire day of work with good documentation.
Without docs?
1 week and I need to sit behind the machine trying stuff out.
Thanks! Playing with it.
10:00
I'm going to eat something.
10:21
0
Q: How to restore the MySQL databases from a corrupted SSD?

Ionică BizăuMy SSD got corrupted. I made a clone of it on an HDD and I have access to all original files from /var/lib/mysql/that_database. I want to import that_database back, but I can't. I tried to copy the raw files, and it didn't work: show tables works, but queries end with that_database.TableName doe...

Asked here @Fabby
Enjoy your meal
 
2 hours later…
12:18
@Fabby So you think there is any hope for this? If you can solve it I'll give you yet another bounty :D
 
6 hours later…
18:02
There is always hope, but I'd need to know more about the database to be able to recover it
and read up on the docs of the file structure of a DB.
If I would have physical access to your machine: 1 day?
can you get a copy from the customer?
Just in case it helps, I have a backup of all the databases which were there, but it's a bit old.
I would need documentation.
Not the company data is the problem, but my data.
What do you have
It's an SQL dump.
Which I contains all the databases.
18:04
Urgh.
I mean documentation: this table is for this, has these keys, these triggers, this is what they're for, ...
OK
Would be nice to recover that part...
I mean, I'd have to see what the DB looked like before starting to recover.
recovering blindly would take an entire week.
not impossible, but tiresome.
I see.
Thank you!
An SQL Dump would help, but I'd have to reverse-engineer the database, document it and then start recovering.
Last time I did a DB recovery was actually in 2009 and before that in 2002
18:08
I got back 100% in 2009
and 99.8% in 2002
(there was less than 1h of data lost)
1h?
Hundred?
I see
1 hour :D
but, Data was lost and the customer was very unhappy about that...
No way, I did it I think!
@Fabby ^
:)
Good! How?
I imported the databases, copied the raw files of the table
Then got the erorr:
Tablespace is missing for table...
Then I did:
ALTER TABLE ActivityEvents DISCARD TABLESPACE
and ALTER TABLE ActivityEvents IMPORT TABLESPACE
18:21
:-)
then it hanged a while and I waited
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '42' at line 1
mysql> select count(*) from ActivityEvents;
+----------+
| count(*) |
+----------+
| 29260671 |
And look ^
In the backup I had only 10M documents
and then :D
Now checking the integrity
looks like you're on the right track.
I would export the data I have now,
drop table
recreate table
mysql> select * from ActivityEvents order by created_at desc limit 1;
+----------+------+--------+---------------------+---------------------+-----------+
| id       | raw  | active | created_at          | updated_at          | friend_id |
+----------+------+--------+---------------------+---------------------+-----------+
| 29276780 |      |      1 | 2018-04-20 13:26:03 | 2018-04-20 13:26:03 |         3 |
+----------+------+--------+---------------------+---------------------+-----------+
1 row in set (6.28 sec)
18:23
import data back
Ah...
only one row
According to my astronomical calculations, that was on Friday, when things got bad. Hahaha
Forget what I said.
order by desc limit 1
18:23
I thought you had 29M rows instead of 10M
Yes, I have.
I will make a backup once I get the others.
Look like you're on the right track after all.
Thanks a lot.
Oh, and there is the Mongo stuff. I hope to recover that too. Hahaha
18:37
OK, full database recovered.
31M records.
This is what a bot collected in 3 months.
And I was like... all right... gonna start from scratch again.

« first day (2 days earlier)    last day (15 days later) »