One day, a gentleman, that is me, entered a server, while sorting out the server, found that there are db_mysql and mysql_data directories under the data directory, and found that mysql_data is not in use,
One day, a gentleman, that is me, entered a server, while sorting out the server, found that the/data directory contains the db_mysql and mysql_data directories, and found that mysql_data is not in use,
One day, a gentleman, that is me, entered a server, while sorting out the server, found that the/data directory contains the db_mysql and mysql_data directories, and found that mysql_data is not in use, so I want to delete all files under mysql_data ......
At this time, it is estimated that the head may be rusty and shake, and even ran to the previous directory to directly rm *-rf. This is bad, and db_mysql was also deleted, db_mysql is a database in use !! I cried :'(:'(
It's useless to cry. You still need to think about how to save it!
Saving process:
1. The data is deleted, but mysql is still running. kill mysql, umount/dev/md0
2. debugfs is everywhere on the network
Debugfs/dev/md0
Enter lsdel
In theory, we can see the deleted file at this time, and then proceed with the next step. Unfortunately, this guy seems to like ext2, and there is nothing displayed under ext3, step 1: Release failed
3. Using mc
Yum install mc
After installing the mc Service
Enter mc directly
The window here should be a little smaller, otherwise it will be garbled
You can see a window where the deleted files are displayed and the recovered files are displayed (maybe so, no research is done)
Input:
Cd undel:/dev/md0
The system prompts that the directory is not found and cannot be chdir.
Continue:
Cd/dev/md0
Same outcome
Directly click in the window to enter, or fail, the second method fails to be declared
3. Use the third-party software ext3grep and cry. Come on, OK. No more, I ...... I ...... Penalty settled
Starting with hope of silk
Installing e2fsprogs is said to require a e2fsprogs-libs, otherwise there will be a problem with the installation of ext3grep later.
Download ext3grep:
The latest version is ext3grep-0.8.0.tar.gz.
Installation:
Cd
Wget
Tar zxvf ext3grep-0.8.0.tar.gz
Cd ext3grep-0.8.0
./Configure
Make install
The installation process is simple. Run ext3grep to check whether the installation is successful.
Recovery started
Ext3grep/dev/md0-ls-inode 2
This is a scan creation, not required
Recovery:
Ext3grep/dev/md0-restore-all
......
To restore a file, run the following command: ext3grep/dev/md0-restore-file 'filepath'
With an uneasy mood, continue waiting ......
ETC scan:
Searching group 1088:
Searching group 1089:
Searching group 1090:
Searching group 1091:
Searching group 1092:
Searching group 1093:
If the result is returned, all files that can be recovered are restored. The recovered files are under the RESTORED_FILES directory under the current directory of extgrep.
Check the directory. Except for the two files in a log table, all files are recovered.
I checked the role of this log table with XXX. I'm lucky. The answer is that this table is no longer in use.
Copy the file to the corresponding directory, start mysql, and test OK.
Oh, yeah !!! Finally succeeded.
Thanks to day, party, people, network dragon, Technical Department, WEB group, cool, fat man, And Carlo Wood.
Quote a sentence from someone else:
"I am crying, and I want to thank Carlo Wood again for deleting him ~ /Home Directory, which gave birth to such a powerful ext3grep. That is why I had time to continue soy sauce. "