分类: 系统运维
2012-04-04 10:42:37
方法如下
一。预备。(请先看注)
据文献2,要装一个e2fsprogs才能安装ext3grep软件
代码:
(注:不装应该也没事,好像是编译库什么的,反正我根据他还是编译不成功,本文介绍用deb直接装的)
安装我们今天的主角:ext3grep,我下载官方源代码编译不成功(菜鸟),所以向大家介绍另一种方法,下载deb直接装。
下载地址:
(幸好ubuntu源自deban,我们有很多东西都可从他那里下)
双击安装就好了
我这里演示一下:首先我的分区如下(虚拟机哈)(用
查看)
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 1.9G 477M 1.3G 27% /
varrun 130M 104K 130M 1% /var/run
varlock 130M 0 130M 0% /var/lock
udev 130M 80K 130M 1% /dev
devshm 130M 12K 130M 1% /dev/shm
lrm 130M 38M 92M 30% /lib/modules/2.6.24-19-generic/volatile
/dev/sda1 76M 17M 56M 23% /boot
/dev/sda3 950M 30M 873M 4% /home
/dev/sda5 3.7G 1.6G 2.0G 46% /usr
这就是我误删文件的分区了
/dev/sda8 265M 13K 251M 1% /wext2
/dev/sda9 95M 33M 62M 35% /xreiserfs
/dev/sda10 93M 144K 93M 1% /yjfs
/dev/sda12 109M 1.0K 109M 1% /zfat32
/dev/sda11 184M 4.3M 180M 3% /zxfs
代码:
注:如果被删除的文件在/或者其他系统分区,那就只能拆下盘挂到其他机子弄,或者livecd下弄吧?(livecd下可以装软件的说),不太清楚,找别的方法去把,不要再看下去了
代码:
会出来下面一段
Running ext3grep version 0.9.0
WARNING: I don't know what EXT3_FEATURE_COMPAT_EXT_ATTR is.
Number of groups: 24
Loading group metadata... done
Minimum / maximum journal block: 526 / 4640
Loading journal descriptors... sorting... done
The oldest inode block that is still in the journal, appears to be from 1224513073 = Mon Oct 20 22:31:13 2008
Number of descriptors in journal: 28; min / max sequence numbers: 8 / 13
Inode is Allocated
Loading sda7.ext3grep.stage2... done
The first block of the directory is 512.
Inode 2 is directory "".
Directory block 512:
.-- File type in dir_entry (r=regular file, d=directory, l=symlink)
| .-- D: Deleted ; R: Reallocated
Indx Next | Inode | Deletion time Mode File name
==========+==========+----------------data-from-inode------+-----------+=========
0 1 d 2 drwxr-xr-x .
1 2 d 2 drwxr-xr-x ..
2 end d 11 drwx------ lost+found
3 4 r 12 D 1224546806 Tue Oct 21 07:53:26 2008 rrw-r--r-- aaa
4 5 r 13 D 1224546806 Tue Oct 21 07:53:26 2008 rrw-r--r-- aaa (3rd copy)
5 6 r 14 D 1224546806 Tue Oct 21 07:53:26 2008 rrw-r--r-- aaa (4th copy)
6 7 r 15 D 1224546806 Tue Oct 21 07:53:26 2008 rrw-r--r-- aaa (another copy)
7 8 r 16 D 1224546806 Tue Oct 21 07:53:26 2008 rrw-r--r-- aaa (copy)
8 end r 17 D 1224546806 Tue Oct 21 07:53:26 2008 rrw-r--r-- aaa~
注意:最后的几行就是我误删除的文件了,名字分别为aaa,aaa (3rd copy),aaa (4rd copy).........
(
请先看完注意再执行本行)
比如说这里我希望恢复aaa文件,
代码:
就会提示你
Running ext3grep version 0.9.0
WARNING: I don't know what EXT3_FEATURE_COMPAT_EXT_ATTR is.
Number of groups: 24
Minimum / maximum journal block: 526 / 4640
Loading journal descriptors... sorting... done
The oldest inode block that is still in the journal, appears to be from 1224513073 = Mon Oct 20 22:31:13 2008
Number of descriptors in journal: 28; min / max sequence numbers: 8 / 13
Loading sda7.ext3grep.stage2... done
Restoring aaa
表示恢复成功,恢复好的文件在你当
前目录的 RESTORED_FILES 文件夹中,,我这里就在/root/RESTORED_FILES中,打开一看,果然有无误删的文件aaa