Linux (for example, Ubuntu16.04) and Windows mistakenly deleted file recovery __linux

Source: Internet
Author: User
Tags bz2

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. ╮(╯▽╰)╭

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.