给虚拟主机添加一块磁盘,磁盘为/dev/vdb 格式化ext4格式,因为它恢复只支持ext2,3,4等格式
[root@server1 ~]# mount /dev/vdb /mnt/disk/
[root@server1 ~]# cd /mnt/disk/
[root@server1 disk]# cd lost+found/
在当磁盘下cop点东西
[root@server1 lost+found]# ls
boke
工具安装部署
官方网站是https://extundelete.sourceforge.net/ ,其目前的稳定版本是extundelete-0.2.4.
编译:
[root@server1 ~]#yum -y install gcc-c++ e2fsprogs.x86_64 e2fsprogs-devel.x86_64
[root@server1 ~]#tar -jxvf extundelete-0.2.4.tar.bz2
[root@server1 ~]#cd extundelete-0.2.4
[root@server1 ~]#./configure
[root@server1 ~]#make && make install
验证安装结果
[root@server1 ~]#extundelete -v
[root@server1 lost+found]# extundelete /dev/vdb –inode 2
#扫描
. 2
.. 2
#最后几行lost+found 11
boke 131073 Deleted
[root@server1 lost+found]# extundelete /dev/vdb –restore-directory boke
[root@server1 lost+found]# ls #生成文件夹
RECOVERED_FILES
[root@server1 lost+found]# cd RECOVERED_FILES/
[root@server1 RECOVERED_FILES]# ls #查看
boke book
先恢复文件(可根据文件名进行恢复):
extundelete /dev/sdb –restore-file
恢复目录(根据目录名恢复):
extundelete /dev/sdb –restore-directory
总结:可用但不理想,恢复文件不是源目录而是自动排列,二次扫描恢复就不行了