linux系统误删数据恢复方法

1.安装恢复数据软件extundelete:
yum安装:
yum install epel-release -y
yum install extundelete -y

源码安装:
yum install epel-release vim wget gcc gcc-c++ -y
yum -y install e2fsprogs*
wget https://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2
tar xf extundelete-0.2.4.tar.bz2
cd extundelete-0.2.4
./configure
make && make install

2.模拟删除数据:
cd /tmp
rm -rf ./*
mkdir a b c
touch 1.txt
touch a/a.txt b/b.txt c/c.txt
echo “this is 1.txt,shuju huifu ceshi wenjian!” >1.txt
echo “this is a.txt,shuju huifu ceshi wenjian!” >a/a.txt
echo “this is b.txt,shuju huifu ceshi wenjian!” >b/b.txt
echo “this is c.txt,shuju huifu ceshi wenjian!” >c/c.txt

rm -rf ./*

3.恢复:
如果分区可以挂载成只读的话最好挂载成只读模式,以免磁盘被覆盖
mount -o remount,ro /home
extundelete /dev/sda5 --inode 2

在这里插入图片描述
extundelete /dev/sda5 --restore-directory abc3
会在当前目录下生成RECOVERED_FILES目录,在RECOVERED_FILES目录下就会有我们恢复的abc3目录文件

extundelete /dev/sda5 --restore-file hello.txt 恢复文件
extundelete /dev/sda5 --restore-all 恢复所有被删除的文件

这个工具恢复的数据也不一定完整,也只是恢复部分数据,恢复全部数据的可能性很小。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值