extundelete误删除恢复工具(ext4文件系统)

工具安装:

[root@localhost ~]# yum -y install e2fsprogs-devel e2fsprogs-libs
[root@localhost ~]# tar -xf extundelete-0.2.4.tar.bz2 
[root@localhost extundelete-0.2.4]# ./configure && make && make install

extundelete命令常用选项:

--inode 数值 	       #指定从inode号多少开始显示
-restore-file 文件名    #恢复误删除的某个文件
-restore-all           #恢复所有文件
-after dtime           #在某个时间点之后删除的文件
-before dtime          #在某个时间点之前删除的文件

模拟删除:

[root@localhost ~]# rm -rf recover_test

第一时间卸载误删除文件所在的分区:

[root@localhost ~]# umount /dev/sdb1

使用extundelete工具恢复文件:

[root@localhost ~]# extundelete --restore-file recover_test /dev/sdb1
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 40 groups loaded.
Loading journal descriptors ... 11 descriptors loaded.
Successfully restored file recover_test

恢复成功后,误删除的文件存放在RECOVERED_FILES的目录中:

[root@localhost ~]# ls
anaconda-ks.cfg  extundelete-0.2.4  install.log  install.log.syslog  RECOVERED_FILES
[root@localhost RECOVERED_FILES]# ls
recover_tes
当误删除文件是在/分区上时:
<1> 误删除文件后,及时进入单用户模式(重启或init 1直接切换)
<2> 修改/etc/fstab文件设置为只读ro
<3> extundelete --restore-file recover_test  


extundelete工具不支持xfs文件系统

猜你喜欢

转载自blog.csdn.net/cql08e/article/details/79969496
今日推荐