How to use Ext3grep to recover mistakenly delete a file

Source: Internet
Author: User
Tags mkdir

First step. View the related libraries that you want

[Root@ns2 ~]# Rpm-qa |grep e2fsprogs

E2fsprogs-libs-1.39-8.el5

E2fsprogs-1.39-8.el5

E2fsprogs-devel-1.39-8.el5

Note: There is no libs program under RHEL4, but can still install Ext3grep 0.7.0

There must be a e2fsprogs-libs, or there will be a problem with the installation of Ext3grep in the back.

Second step. Check the zoning:

[Root@ns2 ~]# Df–h

Step three. Need software

Http://code.google.com/p/ext3grep/downloads/list

Download software First

[Root@ns2 ~]# cd/root/src/

[Root@ns2 src]#

wget http://ext3grep.googlecode.com/files/ext3grep-0.6.0.tar.gz src

Note: The author has downloaded and no longer downloads

Step fourth. Install Ext3grep

A Mount the disc first

Mount/dev/cdrom/media

B. Installation steps:

1.[root@ns2 ~]# tar zxvf ext3grep-0\[1\].10.1.tar.gz–c/usr/src < Extract files to/usr/src directory >

2.[root@ns2 ~]# cd/usr/src/ext3grep-0.10.1-> < access directory >

3.[root@ns2 ~]#./configure < configuration >

4.[root@ns2 ~]# make && make install < compile and install >

The fifth step. To facilitate the experiment, we can simulate one out and the following is the simulation step:

A. # mkdir/data/

B. # cd/data/

C. # dd If=/dev/zero Of=disk1 count=2048000

D. # mkfs.ext3 Disk1

E. # mkdir-p/dfs/a

F. # Mount-o loop/data/disk1/asd/a

#说明, an analog partition/DATA/DISK1 has been established

#在/asd/a New file Beijing, Shanghai

#后将beijing, Shanghai file deletion

#文件没有了然后我们来恢复:

You must first umount the partition that deletes the data:

[Root@ns2 ~]# Umount/data/disk1

[Root@ns2 ~]# Df–h

#确认卸载, and then use Ext3grep to recover.

[Root@ns2 ~]# ext3grep/data/disk1--ls--inode 2 This will create a scan partition

#从图中可以看到被删除的beijing, Shanghai two files

#恢复数据

[Root@ns2 ~]# Ext3grep/data/disk1--restore-file Shanghai

#数据成功恢复

[Root@ns2 ~]# ext3grep/data/disk1--restore-file Beijing

[Root@ns2 ~]# Ls-la restored_files/

Note: Restored data is restored by default to the restored_files/directory

#在RESTORED_FILES下的成功恢复的文件或目录可以做任意操做, the author puts it back in its original position.

Note: So far all the work has been done, if the data in other partitions, the same uninstall mistakenly delete the data partition, to perform the same operation and the same recovery steps!

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.