Under Linux there is a very cool command rm-f, meaning forced deletion, also this is a very dangerous command (can be understood as forbidden Mantra 2333). So I try to avoid using this instruction.
Today I was compiling a C + + file accidentally reversed the target file and source file location, resulting in the same result as RM. So it took a long time to recover the document. Here's a record of the whole process.
First of all, let us analyze why the "delete completely" file can be restored:
When we completely delete a file, it is not removed from the disk, but the area (block) is marked as idle. If the zone is not rewritten, the "delete" data is not lost and its inode is not deleted or changed.
Let's simply confirm the matter:
Create a new "AA" file first
Delete the inode after viewing it
We can view the inode that has been "completely deleted" files using the System file systems debugger function Debugfs.
sudo debugfs
open/dev/sda1
ls-d [filepath]
The second row of file partitions is based on its own partitioning, and it is not clear that the partitions can be viewed by DF. or df-t/home view the file system and usage of the detailed user's partition.
Seems to be pulling a bunch of theoretical stuff. So specifically to see How to recover mistakenly deleted files:
We're going to use a tool called Extundelete.
Cd/tmp
wget http://jaist.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2
tar-xjvf extundelete-0.2.4.tar.bz2
sudo apt-get install e2fsprogs
sudo apt-get
install E2fslibs-dev Rm-f *.tar.bz2
cd ex*
./configure
Make
After the installation was successful, we went to the SRC folder to run Extundelete to restore the recently deleted data.
CD src
sudo./extundelete/dev/sda1--restore-file [filename to recover]
There are other such as restore all files or restore a folder, you can--help.
So how do Windows users recover by accidentally deleting files?
Restore points can be restored by restoring points, as frequently established by Microsoft. In addition, you can try the easyrecovery.
Spit slot: Originally many to say, but csdn this to write the document the interface bar. ╮(╯▽╰)╭