码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-04-18 21:52:59      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:extundelete

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上误删除了文件怎样恢复?

标签:extundelete

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!