本案环境:
[root@bright ~]# uname -r && cat /etc/system-release 2.6.32-504.el6.x86_64 CentOS release 6.6 (Final)
一、安装软件
1.安装依赖包
# yum install e2fsprogs* -y
2.下载并安装extundelete
# wget http://nchc.dl.sourceforge.net/p ... elete-0.2.4.tar.bz2
# tar -jxvf extundelete-0.2.4.tar.bz2
# cd extundelete-0.2.4
# ./configure --prefix=/usr/local/extundelete
# make && make install
3.验证是否安装成功
# cd /usr/local/extundelete/bin
# ./extundelete -v
---------------------
extundelete version 0.2.4
libext2fs version 1.41.12
Processor is little endian.
---------------------
二、模拟数据误删环境:
本案添加了一块新的磁盘来操作:
[root@bright ~]# mount /dev/sdb2 /data/ [root@bright ~]# cp /root/extundelete-0.2.4.tar.bz2 /data/ [root@bright data]# mv extundelete-0.2.4.tar.bz2 test.tar.bz #额,多此一举,请忽略。 [root@bright data]# md5sum test.tar.bz #记录源文件MD5值 77e626ad31433680c0a222069295d2ca test.tar.bz [root@bright mnt]# rm -rf /data/* [root@bright mnt]# cd /mnt [root@bright mnt]# umount /data
三、恢复步骤:
[root@bright mnt]# cd /usr/local/extundelete/bin/ [root@bright bin]# ls extundelete [root@bright bin]# ./extundelete /dev/sdb2 --inode 2 NOTICE: Extended attributes are not restored. Loading filesystem metadata ... 8 groups loaded. Group: 0 Contents of inode 2: 0000 | ed 41 00 00 00 10 00 00 9d 4c 08 55 b9 4c 08 55 | .A.......L.U.L.U 0010 | b9 4c 08 55 00 00 00 00 00 00 02 00 08 00 00 00 | .L.U............ 0020 | 00 00 00 00 05 00 00 00 49 00 00 00 00 00 00 00 | ........I....... 0030 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0080 | 1c 00 00 00 8c 18 94 4b 8c 18 94 4b 4c 01 00 48 | .......K...KL..H 0090 | 0d 4c 08 55 00 00 00 00 00 00 00 00 00 00 00 00 | .L.U............ 00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00b0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00d0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00f0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ Inode is Allocated File mode: 16877 Low 16 bits of Owner Uid: 0 Size in bytes: 4096 Access time: 1426607261 Creation time: 1426607289 Modification time: 1426607289 Deletion Time: 0 Low 16 bits of Group Id: 0 Links count: 2 Blocks count: 8 File flags: 0 File version (for NFS): 0 File ACL: 0 Directory ACL: 0 Fragment address: 0 Direct blocks: 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 Indirect block: 0 Double indirect block: 0 Triple indirect block: 0 File name | Inode number | Deleted status . 2 .. 2 lost+found 11 Deleted extundelete-0.2.4.tar.bz2 12 Deleted test.tar.bz 12 Deleted [root@bright bin]# ./extundelete /dev/sdb2 --restore-file test.tar.bz NOTICE: Extended attributes are not restored. Loading filesystem metadata ... 8 groups loaded. Loading journal descriptors ... 28 descriptors loaded. Successfully restored file test.tar.bz [root@bright bin]# ls ./RECOVERED_FILES/ test.tar.bz [root@bright bin]# md5sum ./RECOVERED_FILES/test.tar.bz #查看恢复出来的文件的MD5值 77e626ad31433680c0a222069295d2ca ./RECOVERED_FILES/test.tar.bz
本文出自 “做梦也想你” 博客,请务必保留此出处http://zmyxn.blog.51cto.com/3029175/1621655
原文地址:http://zmyxn.blog.51cto.com/3029175/1621655