Remedy for running rm-rf in linux

Source: Internet
Author: User
In linux, rm-rf is a terrible command, because issuing this command means that once the deleted file is irrecoverable, is it true? Is there any remedy? The answer is euphemism. It can be remedied under certain conditions. You may be familiar with the remedy for deleting files in windows through related software. You can do the same in linux.

In linuxRm-Rf is a terribleCommandBecause issuing this command means that once deleted files are irrecoverable, is that true? Is there any remedy? The answer is euphemism. Under certain conditions, you can remedy the problem. You may be familiar with the remedy for deleting a file in windows through related software. In linux, You can remedy the problem, but there is a major premise: There is no overwriting action (that is, before trying to restore the deleted data, the Directory of the deleted file cannot store new things). Otherwise, the Overwrite will lose much!

The kit used here isExT3Grep, The system must be installed on the e2fsprogs-libs-1.39-23.el5e by default, 2fsprogs-devel-1.39-23.el5, e2fsprogs-1.39-23.el5 Software
[Root @ localhost ~] # Rpm-qa | grep e2fsprogs
E2fsprogs-libs-1.39-23.el5
E2fsprogs-devel-1.39-23.el5
E2fsprogs-1.39-23.el5
[Root @ localhost ~] # Ll ext3grep-0.10.2.tar.gz
-Rw-r -- 1 root 236364 Oct 17 2011 ext3grep-0.10.2.tar.gz

[Root @ localhost ~] # Tar zxvf ext3grep-0.10.2.tar.gz
[Root @ localhost ~] #CdExt3grep-0.10.2
[Root @ localhost ext3grep-0.10.2] #./configure
[Root @ localhost ext3grep-0.10.2] # make & make install
[Root @ localhost ~] # Ll/usr/local/bin
Total 2656
-Rwxr-xr-x 1 root 2709704 Oct 15 ext3grep // The Executable File

Next, we will demonstrate a remediation process example.

[Root @ localhost ~] #Mkdir/Data // ixdba/

[Root @ localhost data] #DdIf =/dev/zero of = data-disk bs = 1 M count = 105
[Root @ localhost data] #Mkfs. Ext3 data-disk // File System in the format of ext3, enter y at the prompt that appears
[Root @ localhost data] # mount-o loop/data-disk/ixdba // mount
[Root @ localhost data] #Cp/Etc/host */ixdba // put the file inside
[Root @ localhost data] # cp/etc/Passwd/Ixdba/
[Root @ localhost data] # cd/ixdba/
[Root @ localhost data] # rm-rf * // create a delete action
[Root @ localhost data] # cd/data/

[Root @ localhost data] # ext3grep/data-disk --Ls-- Inode 2 // view the lost file

[Root @ localhost data] # ext3grep/data-disk --Restore-FilePasswd // only restore the file passwd
[Root @ localhost data] # ext3grep/data-disk -- restore-all // restore all

[Root @ localhost data] # ls
Data-disk data-disk.ext3grep.stage1 data-disk.ext3grep.stage2 RESTORED_FILES
[Root @ localhost data] # ll RESTORED_FILES // all recovered files are stored in this folder and retrieved.
Total 48
-Rw-r -- 1 root 17 Oct 15 06:03 host. conf
-Rw-r -- 1 root 187 Oct 15 :03 hosts
-Rw-r -- 1 root 161 Oct 15 :03 hosts. allow
-Rw-r -- 1 root 347 Oct 15 :03 hosts. deny
Drwx ------ 2 root 4096 Oct 15:04 lost + found
-Rw-r -- 1 root 1635 Oct 15 passwd

Summary: only the first restoration action can be implemented here, and there cannot be any overwriting action. This is a long time ago known knowledge, so take a note here to deepen your memory!

 

Related Article

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.