10个G的数据被误删除了,差点崩溃,试遍了所有常规恢复软件,无用,就要放弃的时候,发现了ext3grep这个开源东东!
顺利恢复所有数据,所以linux下数据删除并不可怕,可怕的是删除后没有恢复的方法,看看下面的操作吧!
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux
其实什么版本的系统无所谓 !
所需的相关库
[root@localhost ~]# rpm -qa |grep e2fsprogs
e2fsprogs-libs-1.39-8.el5
e2fsprogs-1.39-8.el5
e2fsprogs-devel-1.39-8.el5
必须要有e2fsprogs-libs,不然在后面ext3grep的安装会有问题。
分区情况:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.2G 1.8G 4.2G 30% /
/dev/sda1 99M 11M 83M 12% /boot
/dev/mapper/VolGroup00-LogVol02
1008M 34M 924M 4% /data
tmpfs 125M 0 125M 0% /dev/shm
需要软件
先下载软件
[root@localhost ~]# cd /root/src/
[root@localhost src]# wget src
[root@localhost src]# ls
ext3grep-0.6.0.tar.gz
[root@localhost src]# tar xfvz ext3grep-0.6.0.tar.gz
[root@localhost ext3grep-0.6.0]# ./configure
[root@localhost ext3grep-0.6.0]# make install
[root@localhost ext3grep-0.6.0]# ext3grep
Running ext3grep version 0.6.0
编译然后测试可以使用了,一切做好了以后开始我们的恢复过程。
我的目录是/data分区,我先格式化了分区,我放一个文件在根目录下和一个子目录下的文件。
/dev/mapper/VolGroup00-LogVol02 1008M 34M 924M 4% /data
下面斜体部分不是必须的:
其实这里用什么分区倒是无所谓,也可以模拟一个出来,下面是模拟步骤:
1. mkdir /data1/
2. cd /data1/
3. dd if=/dev/zero of=disk1 count=2048000
4. mkfs.ext3 disk1
5. mkdir -p /dfs/a
6. mount -o loop /data1/disk1 /dfs/a
这里,我们用/data分区,先拷贝些文件过去
[root@localhost ~]# ]# cp /bin/ls /data/
[root@localhost ~]# ]# cp -rf /bin /data/
[root@localhost ~]# ]# ls -la /data/
total 136
drwxr-xr-x 4 root root 4096 Apr 21 17:37 .
drwxr-xr-x 25 root root 4096 Apr 21 17:11 ..
drwxr-xr-x 2 root root 4096 Apr 21 17:37 bin
drwx—— 2 root root 16384 Apr 21 17:15 lost+found
-rwxr-xr-x 1 root root 93560 Apr 21 17:37 ls
[root@localhost ~]#
一个子目录一个可执行文件
现在删除ls文件和bin下面的zcat
[root@localhost ~]# rm /data/ls
rm: remove regular file `/data/ls’? y
[root@localhost ~]# rm /data/bin/zcat
rm: remove regular file `/data/bin/zcat’? y
[root@localhost ~]# ls -la /data/ls /data/bin/zcat
ls: /data/ls: No such file or directory
ls: /data/bin/zcat: No such file or directory
文件没有了然后我们来恢复:
首先必须umount掉误删除数据的分区:
[root@localhost ~]# umount /dev/mapper/VolGroup00-LogVol02
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.2G 1.8G 4.2G 30% /
/dev/sda1 99M 11M 83M 12% /boot
tmpfs 125M 0 125M 0% /dev/shm
确认卸载,然后使用ext3grep来恢复。
[root@localhost ~]# ext3grep /dev/mapper/VolGroup00-LogVol02 --ls --inode 2
这里会创建扫描分区
[root@localhost ~]# ext3grep /dev/mapper/VolGroup00-LogVol02 --ls --inode 2
[root@localhost ~]# ext3grep /dev/mapper/VolGroup00-LogVol02 --restore-file ls
Running ext3grep version 0.6.0
WARNING: I don’t know what EXT3_FEATURE_COMPAT_EXT_ATTR is.
Number of groups: 8
Minimum / maximum journal block: 585 / 8787
Loading journal descriptors… sorting… done
Number of descriptors in journal: 58; min / max sequence numbers: 2 / 5
Loading VolGroup00-LogVol02.ext3grep.stage2… done
Restoring ls
[root@localhost ~]# ext3grep /dev/mapper/VolGroup00-LogVol02 --restore-file bin/ls
Running ext3grep version 0.6.0
WARNING: I don’t know what EXT3_FEATURE_COMPAT_EXT_ATTR is.
Number of groups: 8
Minimum / maximum journal block: 585 / 8787
Loading journal descriptors… sorting… done
Number of descriptors in journal: 58; min / max sequence numbers: 2 / 5
Loading VolGroup00-LogVol02.ext3grep.stage2… done
Restoring bin/ls
[root@localhost ~]# ls -la RESTORED_FILES/
total 124
drwxr-xr-x 3 root root 4096 Apr 21 18:01 .
drwxr-x— 5 root root 4096 Apr 21 17:55 ..
-rwxr-xr-x 1 root root 93560 Apr 21 17:48 ls
[root@localhost ~]# ext3grep /dev/mapper/VolGroup00-LogVol02 --restore-file bin/zcat
Running ext3grep version 0.6.0
WARNING: I don’t know what EXT3_FEATURE_COMPAT_EXT_ATTR is.
Number of groups: 8
Minimum / maximum journal block: 585 / 8787
Loading journal descriptors… sorting… done
Number of descriptors in journal: 58; min / max sequence numbers: 2 / 5
Loading VolGroup00-LogVol02.ext3grep.stage2… done
Restoring bin/zcat
[root@localhost ~]# ls -la RESTORED_FILES/bin/
total 188
drwxr-xr-x 2 root root 4096 Apr 21 18:01 .
drwxr-xr-x 3 root root 4096 Apr 21 18:01 ..
-rwxr-xr-x 1 root root 62136 Apr 21 17:48 zcat
看看都恢复在RESTORED_FILES目录下,大小也一样,这里RESTORED_FILES目录是执行ext3grep的当前目录下!
也可以使用:
ext3grep /termite/cc-disk --restore-all
恢复所有文件和目录,但是目录的话,如果删除时间较长,不一定能完全恢复,压缩文件一般都能恢复。
如果想详细的了解ext3grep,可以到它的的HOW TO页去看看:
[ 本帖最后由 南非蚂蚁 于 2008-12-30 12:18 编辑 ]
彪哥来了 (2008-12-30 11:56:03)
yessym518 (2009-5-12 15:51:21)
newpublic (2009-5-30 17:46:34)
郁闷
湖湘文化 (2009-5-30 17:56:52)
atianyu (2009-6-01 15:13:19)
shitiancai (2009-6-02 17:43:23)
atianyu (2009-6-26 13:27:04)
[root@localhost ~]# rpm -qa |grep e2fsprogs
e2fsprogs-libs-1.39-8.el5
e2fsprogs-1.39-8.el5
e2fsprogs-devel-1.39-8.el5
必须要有e2fsprogs-libs,不然在后面ext3grep的安装会有问题。
------斑竹,我真是在安装的时候出问题了,信息如下.另外你说的那些库我在网上找的和你说的版本不一样,安装不上去,如下
e2fsprogs-1.41.0-1.fc9.src.rpm e2fsprogs-devel-1.41.4-5.fc10.i386.rpm e2fsprogs-libs-1.41.4-4.fc10.i386.rpm
linux:~/src/ext3grep-0.6.0 # ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...........................
checking for ext2fs/ext2_fs.h... no
checking ext2fs/ext2fs.h usability... no
checking ext2fs/ext2fs.h presence... no
checking for ext2fs/ext2fs.h... no
configure: error: Missing headers. Please install the package e2fslibs-dev from e2fsprogs, or for the upstream tar-ball.
linux:~/src/ext3grep-0.6.0 # make install
make: *** No rule to make target `install'. Stop.
linux:~/src/ext3grep-0.6.0 #
还请帮忙支个招,谢谢!
9595139687 (2009-6-29 16:58:57)
tiqit2 (2009-7-01 20:05:16)
南非蚂蚁 (2009-7-02 10:45:53)
QUOTE:
错误已经很明显了:configure: error: Missing headers. Please install the package e2fslibs-dev from e2fsprogs, or for the upstream tar-ball.
configure无法通过,Makefile就无法生成,自然无法make
lfree (2009-7-02 17:09:51)
botao001213 (2009-7-08 12:03:59)
yumen1130 (2009-11-12 12:13:43)
e2fsprogs-libs-1.39-8.el5
e2fsprogs-1.39-8.el5
e2fsprogs-devel-1.39-8.el5
这个到那里可以找到呢?谢谢救命啊
stshen (2010-2-02 13:21:30)
love-linux_cu (2010-2-02 15:09:47)
xiongchangming (2010-2-03 14:39:38)
alonerhu (2010-2-05 08:52:18)
liaohuachao (2010-3-01 15:56:20)