extundelete 恢復誤刪文件

本案環境:

[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



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章