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