Recovery of MySQL data mistakenly deleted (drop). (Ext3grep, Extundelete)

Source: Internet
Author: User

drop table Tbl_name Physical deletion. No backup, no binary log

Deleting files in the system does not erase the data in the store, but only identifies the block blocks that can be reused for redistribution.
So the recovery of data is still hopeful. However, the recovered data blocks cannot be overwritten by other data, and the file system itself is normal.

1. Stop MySQL Now

2. View the inode number of the MySQL installation directory. Generally if there is only one MySQL directory on a disk, then the Inode is 2.
ll-id/usr/local/mysql/

3. Umount/path/to/mysql_data

Tool dependencies: (in the installation package CD-ROM)
Yum Install e2fsprogs-devel.x86_64 e2fsprogs-libs.x86_64 e2fsprogs.x86_64-y


tool a Extundelete. Applicable with Ext4 file system

Tar XF extundelete-0.2.4.tar.bz2
CD extundelete-0.2.4
./configure
Make && make install

EXTUNDELETE/DEV/SQLBAK/SQLBCK_LV--inode 2 # #查看mysql安装目录下的所有文件
Extundelete/dev/sqlbak/sqlbck_lv--inode 97537# #选择mysql安装目录下的data目录
Extundelete/dev/sqlbak/sqlbck_lv--inode 97541# #继续查找想应的想要恢复的文件
....
Extundelete/dev/sqlbak/sqlbck_lv--restore-inode 97653 # #恢复想要恢复的文件, will be at the end of the file
There are deleted signs.
MV recovered_files/file.97653 T2. MYD # #rename The original file

Mount MySQL directory, MV recover files, modify master for MySQL, boot file

--------Instance----------

Inode is allocated
File mode:16877
Low + bits of Owner uid:0
Size in bytes:1024
Access time:1450538126
...
File name | Inode number | Deleted status
. 2
.. 2
Bin 32513
COPYING 11
Data 97537
...
Lib 130053
Lost+found 15
Mysql-test 16


Tool two Ext3grep for use with Ext3 file system
Similarly, the dependency package, installation environment is the same
Ext3grep/dev/sqlbak/sqlbck_lv--ls--inode #多一个--ls
EXT3GREP/DEV/SQLBAK/SQLBCK_LV--restore-inode 97653

Recovery of MySQL data mistakenly deleted (drop). (Ext3grep, Extundelete)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.