一、删除文件后有点担心不能恢复,现在不用怕了,有这个工具就可以了,很好用的
1,下载工具
[root@44 ~]# wget
http://ext3grep.googlecode.com/files/ext3grep-0.6.0.tar.gz
2,安装
先检查下这三个包是否已经安装,没有的话先安装下,检查有没有安装gcc c++工具是否安装
[root@44 ~]# rpm -qa |grep e2fs
e2fsprogs-devel-1.39-23.el5
e2fsprogs-libs-1.39-23.el5
e2fsprogs-1.39-23.el5
e2fsprogs-devel-1.39-23.el5
e2fsprogs-libs-1.39-23.el5
e2fsprogs-1.39-23.el5
[root@44 ~]#yum install c++* -y
3,安装
[root@44 ~]# tar xzvf ext3grep-0.6.0.tar.gz
[root@44 ~]# cd ext3grep-0.6.0
[root@44 ext3grep-0.6.0]# ./configure ; make ; make install
[root@44 ext3grep-0.6.0]# ./configure ; make ; make install
4,编译安装完成后就可以使用这个工具了
[root@44 ext3grep-0.10.1]# ext3grep -v
Running ext3grep version 0.6.0
ext3grep v0.10.1, Copyright (C) 2008 Carlo Wood.
ext3grep comes with ABSOLUTELY NO WARRANTY;
This program is free software; your freedom to use, change
and distribute this program is protected by the GPL.
Running ext3grep version 0.6.0
ext3grep v0.10.1, Copyright (C) 2008 Carlo Wood.
ext3grep comes with ABSOLUTELY NO WARRANTY;
This program is free software; your freedom to use, change
and distribute this program is protected by the GPL.
5,下面测试下恢复效果
[root@44 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 47G 2.3G 43G 6% /
/dev/sda3 487M 11M 451M 3% /home
/dev/sda1 190M 12M 169M 7% /boot
tmpfs 125M 0 125M 0% /dev/shm
/dev/sdb9 on /mnt type ext3 (rw)
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 47G 2.3G 43G 6% /
/dev/sda3 487M 11M 451M 3% /home
/dev/sda1 190M 12M 169M 7% /boot
tmpfs 125M 0 125M 0% /dev/shm
/dev/sdb9 on /mnt type ext3 (rw)
6,使用/dev/sdb9来做测试
[root@44 ~]# cd /mnt
[root@44 mnt]# cp /etc/dhcp6c.conf .
[root@44 mnt]# cp -r /etc/yum.repos.d .
[root@44 mnt]# ll
total 14
-rw-r--r-- 1 root root 178 Jan 22 23:58 dhcp6c.conf
drwx------ 2 root root 12288 Jan 22 22:52 lost+found
drw-r--r-- 1 root root 346 Jan 22 23:59 yum.repos.d
[root@44 mnt]# cp -r /etc/yum.repos.d .
[root@44 mnt]# ll
total 14
-rw-r--r-- 1 root root 178 Jan 22 23:58 dhcp6c.conf
drwx------ 2 root root 12288 Jan 22 22:52 lost+found
drw-r--r-- 1 root root 346 Jan 22 23:59 yum.repos.d
[root@44 mnt]# rm -rf *
[root@44 mnt]# ls
[root@44 mnt]#
现在将 /mnt下的东西都删掉了
[root@44 mnt]# ls
[root@44 mnt]#
现在将 /mnt下的东西都删掉了
7,进行恢复
1,执行这条命令查看删除的所有文件
[root@44 ~]# ext3grep /dev/sdb9 --ls --inode 2
[root@44 ~]# ext3grep /dev/sdb9 --ls --inode 2
2,恢复单个文件
[root@44 ~]# ext3grep /dev/sdb9 --restore-file dhcp6c.conf
Running ext3grep version 0.6.0
Number of groups: 13
Minimum / maximum journal block: 526 / 4640
Loading journal descriptors... sorting... done
N umber of descriptors in journal: 828; min / max sequence numbers: 2 / 4
Loading sdb9.ext3grep.stage2.... done
Restoring dhcp6c.conf
Running ext3grep version 0.6.0
Number of groups: 13
Minimum / maximum journal block: 526 / 4640
Loading journal descriptors... sorting... done
N umber of descriptors in journal: 828; min / max sequence numbers: 2 / 4
Loading sdb9.ext3grep.stage2.... done
Restoring dhcp6c.conf
4恢复所有文件
[root@44 ~]# ext3grep /dev/sdb9 --restore-all
5,编辑恢复的文件
[root@44 RESTORED_FILES]# vi dhcp6c.conf
#
# See dhcp6c.conf(5) man page for details.
#
# See dhcp6c.conf(5) man page for details.
#
#interface eth0 {
# #information-only;
# send rapid-commit;
# request prefix-delegation;
# #request temp-address;
#};
~文件恢复成功,然后将他拷贝到删除文件的目录下就可以了
# #information-only;
# send rapid-commit;
# request prefix-delegation;
# #request temp-address;
#};
~文件恢复成功,然后将他拷贝到删除文件的目录下就可以了
附件:http://down.51cto.com/data/2357876
本文转自zhaoyun00 51CTO博客,原文链接:http://blog.51cto.com/zhaoyun/535903