linux中 centos6 文件误删如何恢复

服务器版本:Centos6

误删之后 不要操作别的 首先卸载或者把这个改成只读的权限

1.上传工具包并且解压

[root@wzp ~] rz extundelete-0.2.4.tar.bz2 

[root@local ~] tar xf extundelete-0.2.4.tar.bz2

2.yum安装所需的服务

[root@wzp ~] yum -y install gcc* e2fs*
1

3.进入extundelete开始安装

[root@wzp ~]# cd extundelete-0.2.4
[root@wzp extundelete-0.2.4]# ./configure 
Configuring extundelete 0.2.4
Writing generated files to disk
[root@wzp extundelete-0.2.4]# make -j 4
make -s all-recursive
Making all in src
extundelete.cc:571: 警告:未使用的参数‘flags’
[root@wzp extundelete-0.2.4]# make install
Making install in src
  /usr/bin/install -c extundelete '/usr/local/bin'
[root@wzp extundelete-0.2.4]# echo "$?"
0

4.错误删除文件

[root@wzp sdb1]# cd /tmp/sdb1/
[root@wzp sdb1]# echo '123' > 1.txt
[root@wzp sdb1]# cp /etc/passwd ./
[root@wzp sdb1]# ls
1.txt  passwd
#文件不能为空
[root@wzp sdb1]# rm -rf ./*
[root@wzp sdb1]# ls
[root@wzp sdb1]# 

5,卸载分区

[root@wzp ~]# umount /dev/sdb1 /tmp/sdb1/

6,恢复文件

[root@wzp ~]# extundelete /dev/sdb1 --inode 2 #查看所有删除的inode号
File name                                       | Inode number | Deleted status
.                                                 2
..                                                2
lost+found                                        11             Deleted
1.txt                                             12             Deleted
2.txt                                             13             Deleted

[root@wzp ~]# extundelete /dev/sdb1 --restore-inode 12 #通过inode号恢复数据
[root@wzp ~]# extundelete /dev/sdb1 --restore-file 1.txt #通过file文件恢复
[root@wzp ~]# extundelete /dev/sdb1 --restore-directory 文件名 #通过目录恢复
[root@wzp ~]# extundelete /dev/sdb1 --restore-all #恢复全部删除文件
[root@wzp ~]# cd RECOVERED_FILES/
[root@wzp RECOVERED_FILES]# ls
1.txt  file.12
#只恢复里面有数据的文件,没有的就不可恢复
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

时倾 | 职业人生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值