extundelete测试

Linux · cdshrewd · 于 1年前发布 · 615 次阅读

extundelete可以用于恢复在Linux下误删除的文件,优点是简单高效,缺点是无法恢复/文件系统下的文件。

下载:http://pkgs.fedoraproject.org/repo/pkgs/extundelete/extundelete-0.2.4.tar.bz2/77e626ad31433680c0a222069295d2ca/extundelete-0.2.4.tar.bz2

前置:[root@rac1 testrm]# rpm -qa|grep e2fsprogs

e2fsprogs-libs-1.41.12-14.el6.x86_64

e2fsprogs-1.41.12-14.el6.x86_64

e2fsprogs-devel-1.41.12-14.el6.x86_64

安装:

tar -jxvf extundelete-0.2.4.tar.bz2

cd extundelete-0.2.4

./configure

make&&make install

[root@rac1 extundelete]# cd extundelete-0.2.4

[root@rac1 extundelete-0.2.4]# ls

acinclude.m4 autogen.sh configure depcomp LICENSE Makefile.in README

aclocal.m4 config.h.in configure.ac install-sh Makefile.am missing src

[root@rac1 extundelete-0.2.4]# ./configure

Configuring extundelete 0.2.4

Writing generated files to disk

[root@rac1 extundelete-0.2.4]# make && make install

make -s all-recursive

Making all in src

extundelete.cc:571: warning: unused parameter 鈥榝lags鈥?

                                                      Making install in src
                                                      

/usr/bin/install -c extundelete '/usr/local/bin'

[root@rac1 extundelete-0.2.4]# extundelete -v

extundelete version 0.2.4

libext2fs version 1.41.12

Processor is little endian.

准备测试数据:

[root@rac1 extundelete-0.2.4]# mkdir /testrm

[root@rac1 extundelete-0.2.4]# mkfs.ext3 /dev/sdb1

mke2fs 1.41.14 (22-Dec-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

131072 inodes, 524112 blocks

26205 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=536870912

16 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

    32768, 98304, 163840, 229376, 294912
    

Writing inode tables: done

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@rac1 extundelete-0.2.4]# mount /dev/sdb1 /testrm/

[root@rac1 extundelete-0.2.4]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg_rac1-lv_root

                   27G  3.0G   23G  12% /
                   

tmpfs 1.3G 76K 1.3G 1% /dev/shm

/dev/sda1 485M 38M 422M 9% /boot

/dev/sdb1 2.0G 36M 1.9G 2% /testrm

[root@rac1 extundelete-0.2.4]# cd testrm

-bash: cd: testrm: No such file or directory

[root@rac1 extundelete-0.2.4]# cd /testrm

[root@rac1 testrm]# ls

lost+found

[root@rac1 testrm]# cp /tmp/extundelete/ /testrm

cp: omitting directory `/tmp/extundelete/'

[root@rac1 testrm]# cp -RP /tmp/extundelete/ /testrm

[root@rac1 testrm]# ls

extundelete lost+found

[root@rac1 testrm]# rm -rf extundelete/

[root@rac1 testrm]# ls -l

total 16

drwx------ 2 root root 16384 Nov 18 22:47 lost+found

[root@rac1 /]# extundelete /dev/sdb1 --restore-all

NOTICE: Extended attributes are not restored.

Loading filesystem metadata ... 16 groups loaded.

Loading journal descriptors ... 38 descriptors loaded.

Searching for recoverable inodes in directory / ...

55 recoverable inodes found.

Looking through the directory structure for deleted files ...

0 recoverable inodes still lost.

[root@rac1 /]# ls

bin cgroup etc lib lost+found misc net proc root selinux sys tmp usr

boot dev home lib64 media mnt opt RECOVERED_FILES sbin srv testrm u01 var

[root@rac1 /]#

[root@rac1 /]#

[root@rac1 /]# cd RECOVERED_FILES

[root@rac1 RECOVERED_FILES]# ls

extundelete

[root@rac1 RECOVERED_FILES]#

[root@rac1 RECOVERED_FILES]# cd extundelete/

[root@rac1 extundelete]# ls

extundelete-0.2.4 extundelete-0.2.4.tar.bz2

[root@rac1 extundelete]# du -sk

4976 .

[root@rac1 extundelete]#

至此,所有文件恢复完成。

本文由 cdshrewd 创作,采用 知识共享署名 3.0 中国大陆许可协议 进行许可。 可自由转载、引用,但需署名作者且注明文章出处。


共收到 1 条回复
ruyi#11年前 0 个赞

这个工具是做什么的呢,文件恢复呢,能否用简易的文字描述下

回复本帖 (需要登录)