"Unmount the partition where the file was mistakenly deleted, or mount as read-only"
When you find that you have deleted the file by mistake, the first thing to do is to immediately unload the partition where the file was mistakenly deleted, or to hang it in a read-only manner. If the root partition is deleted by mistake, it is best to power down directly, go to single user mode, hang the partition in a read-only manner, and then restore
Mount-o ro,remount/dev/sdb/mnt
If you are not deleting the root partition, use Umount to uninstall the partition UMOUNT/DEV/SDB3
"Installing the Ext3grep Tool"
Download Ext3grep tool, Http://code.google.com/p/Ext3grep/downloads/list
Tar zxf ext3grep-0.10.1.tar.gz
cd/home/easwy/ext3grep-0.10.1
./configure
Make
Make install
"Recover Files"
The EXT3GREP program creates a directory named Restored_files in the current directory to hold the recovered files
If you remember the deleted file name and its path, you can use the following command to restore it:
Ex3grep/dev/your-device--restore-file Path/to/your/file/filename
Suppose the file you want to recover is/home/easwy/vi/tips.xml
EX3GREP/DEV/SDS3--restore-file Easywy/vi/tips/xml
If you forget the file name, you can use the following command to query:
Ext3grep/dev/sda3--dump-names | Tee filename.txt
And then you can use the above command to restore the line.
This article is from the "Paraquat Susan" blog, so be sure to keep this source http://suxin.blog.51cto.com/535505/1677708
How to recover files that were mistakenly deleted under Linux and how to prevent files from being deleted