Linux lsof recover deleted files by mistake

Source: Internet
Author: User

Woke up in the morning was told that last night accidentally deleted 3 MySQL files, can only restore the

This is the file information before the deletion:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7A/B5/wKioL1axa3SyzCq8AAATZMF9_Wc943.png "title=" 1.png " alt= "Wkiol1axa3syzcq8aaatzmf9_wc943.png"/>

First Lsof Review the process:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7A/B5/wKioL1axa8Th9xHzAABLZD0uUb4052.png "title=" 2.png " alt= "Wkiol1axa8th9xhzaablzd0uub4052.png"/>

Here the PID is the same, below into proc ls-l view:

# cd/proc/8784/fd/

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7A/B6/wKiom1axbDeiUsmAAABEF3Dg4rA544.png "title=" 3.png " alt= "Wkiom1axbdeiusmaaabef3dg4ra544.png"/>

Here you can see the information ibdata1 deleted.

Then direct CP copy

#cp 4/tmp/ibdata1.bak

The remaining 2 empathy restores, following the recovered files:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7A/B6/wKiom1axbJTQQ7cFAAAWgYnvrew121.png "title=" 4.png " alt= "Wkiom1axbjtqq7cfaaawgynvrew121.png"/>

+++++++++++++++++++++++++++++++++++++++++++++

Although restored, but things absolutely not so simple!!!

Because, in the InnoDB buffer pool, there are many dirty page (that is, the data in memory has been modified, but not written back to the file), if the file directly copied back, light data loss, heavy ibdata1 file corruption.

We must ensure that all data modifications in the buffer pool are saved to the hard disk file, and then the file is restored.


This article is from the "Bamboo Potential" blog, please be sure to keep this source http://peaceweb.blog.51cto.com/3226037/1740868

Linux lsof recover deleted files by mistake

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.