首页 > 其他 > 详细

centos6上误删除了文件怎样恢复?

时间:2018-04-18 21:49:53      阅读:240      评论:0      收藏:0      [点我收藏+]
centos6上误删除了文件怎样恢复?

  • 创建一个新磁盘 /dev/sdb,创建分区 /dev/sdb1,格式化,挂载到 /tmp/sdb1上

  • 模拟环境
mkdir /tmp/sdb1
cp /etc/passwd /tmp/sdb1/
cp /etc/hosts /tmp/sdb1/
mkdir -p /tmp/sdb1/a/b/c
echo aaa > /tmp/sdb1/a.txt
echo bbb > /tmp/sdb1/a/b/b.txt
touch /tmp/sdb1/a/b/kong.txt
cd /tmp/sdb1/
rm -rf a a.txt hosts passwd
  • 安装 extundelete
yum install e2fsprogs-devel -y
cd /usr/local/src/
wget https://sourceforge.net/projects/extundelete/files/latest/download/extundelete-0.2.4.tar.bz2
tar jxvf extundelete-0.2.4.tar.bz2
cd extundelete-0.2.4
yum install gcc-c++ -y
./configure --prefix=/usr/local/extundelete && make && make install
  • 卸载 /tmp/sdb1
umount /tmp/sdb1/
  • 查看删除掉的文件
/usr/local/extundelete/bin/extundelete /dev/sdb1/ --inode 2
  • 恢复所有
/usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-all

常用选项

/usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-inode 12
/usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-file passwd
/usr/local/extundelete/bin/extundelete /dev/sdb1 --restore-directory a

查看 extundelete 的帮助信息

/usr/local/extundelete/bin/extundelete -h

centos6上误删除了文件怎样恢复?

原文:http://blog.51cto.com/13480443/2105088

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!