服務器版本:Centos6
誤刪之後 不要操作別的 首先卸載或者把這個改成只讀的權限
1.上傳工具包並且解壓
[root@wzp ~] rz extundelete-0.2.4.tar.bz2
[root@local ~] tar xf extundelete-0.2.4.tar.bz2
2.yum安裝所需的服務
[root@wzp ~] yum -y install gcc* e2fs*
1
3.進入extundelete開始安裝
[root@wzp ~]# cd extundelete-0.2.4
[root@wzp extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
Writing generated files to disk
[root@wzp extundelete-0.2.4]# make -j 4
make -s all-recursive
Making all in src
extundelete.cc:571: 警告:未使用的參數‘flags’
[root@wzp extundelete-0.2.4]# make install
Making install in src
/usr/bin/install -c extundelete '/usr/local/bin'
[root@wzp extundelete-0.2.4]# echo "$?"
0
4.錯誤刪除文件
[root@wzp sdb1]# cd /tmp/sdb1/
[root@wzp sdb1]# echo '123' > 1.txt
[root@wzp sdb1]# cp /etc/passwd ./
[root@wzp sdb1]# ls
1.txt passwd
#文件不能爲空
[root@wzp sdb1]# rm -rf ./*
[root@wzp sdb1]# ls
[root@wzp sdb1]#
5,卸載分區
[root@wzp ~]# umount /dev/sdb1 /tmp/sdb1/
6,恢復文件
[root@wzp ~]# extundelete /dev/sdb1 --inode 2 #查看所有刪除的inode號
File name | Inode number | Deleted status
. 2
.. 2
lost+found 11 Deleted
1.txt 12 Deleted
2.txt 13 Deleted
[root@wzp ~]# extundelete /dev/sdb1 --restore-inode 12 #通過inode號恢復數據
[root@wzp ~]# extundelete /dev/sdb1 --restore-file 1.txt #通過file文件恢復
[root@wzp ~]# extundelete /dev/sdb1 --restore-directory 文件名 #通過目錄恢復
[root@wzp ~]# extundelete /dev/sdb1 --restore-all #恢復全部刪除文件
[root@wzp ~]# cd RECOVERED_FILES/
[root@wzp RECOVERED_FILES]# ls
1.txt file.12
#只恢復裏面有數據的文件,沒有的就不可恢復