linux恢复rm删除文件ext4,EXT4中恢复使用rm命令误删除的文件
工具:extundelete
关于ext4 文件系统的知识:http://www.ibm.com/developerworks/cn/linux/l-cn-filesrc5/
一、安装# wget http://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.0/extundelete-0.2.0.tar.bz2
# tar -xvf extundelete-0.2.0.tar.bz2
# cd extundelete-0.2.0
# mkdir /usr/local/extundelete
# ./configure --prefix=/usr/local/extundelete
[root@paylm-164 extundelete-0.2.0]# ./configure --prefix=/usr/local/extundelete
Configuring extundelete 0.2.0
configure: error: C++ compiler cannot create executables
See `config.log' for more details.
[root@paylm-164 extundelete-0.2.0]yum install gcc-c++.x86_64 //安装编译工具包
[root@paylm-164 extundelete-0.2.0]./configure --prefix=/usr/local/extundelete
[root@paylm-164 extundelete-0.2.0] yum -y install e2fsprogs* # 如果提示找不到ext2fs库,使用 yum -y install e2fsprogs* 安装
[root@paylm-164 extundelete-0.2.0] ./configure --prefix=/usr/local/extundelete
[root@paylm-164 extundelete-0.2.0] make && make install
[root@paylm-164 extundelete-0.2.0] make clean
# 安装完成。
下面挂载分区作为测试:
三、 恢复被删除去的文件
1. 马上umount 要恢复的文件分区
# umount /mnt1/loop100M
2. 使用extundelete查看分区上存在的文件:
# --inode 为查找某i节点中的内容,使用2则说明为搜索,如果需要进入目录搜索,只须要指定目录I节点即可
[root@paylm-164 /]# /usr/local/extundelete/bin/extundelete --inode 2 /loop/disk_ 100M
WARNING: Extended attributes are not restored.
Loading filesystem metadata ... 13 groups loaded.
Contents of inode 2:
0000 | ed 41 00 00 00 04 00 00 55 db c4 56 49 db c4 56 | .A......U..VI..V
0010 | 49 db c4 56 00 00 00 00 00 00 04 00 02 00 00 00 | I..V............
0020 | 00 00 00 00 01 00 00 00 10 01 00 00 00 00 00 00 | ................
0030 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
Inode is Allocated
Group: 0
File mode: 16877
Low 16 bits of Owner Uid: 0
Size in bytes: 1024
Access time: 1455741781
Creation time: 1455741769
Modification time: 1455741769
Deletion Time: 0
Low 16 bits of Group Id: 0
Links count: 4
Blocks count: 2
File flags: 0
File version (for NFS): 0
File ACL: 0
Directory ACL: 0
Fragment address: 0
Direct blocks: 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Indirect block: 0
Double indirect block: 0
Triple indirect block: 0
File name | Inode number | Deleted status
Directory block 272:
. 2
.. 2
lost+found 11
test 12
[root@paylm-164 /]# /usr/local/extundelete/bin/extundelete --inode 12 /lo
loop/ lost+found/
2.1 再次搜索inod 12下面的文件
[root@paylm-164 /]# /usr/local/extundelete/bin/extundelete --inode 12 /loop/disk _100M
WARNING: Extended attributes are not restored.
Loading filesystem metadata ... 13 groups loaded.
Contents of inode 12:
0000 | ed 41 00 00 00 04 00 00 5b db c4 56 b4 db c4 56 | .A......[..V...V
0010 | b4 db c4 56 00 00 00 00 00 00 02 00 04 00 00 00 | ...V............
0020 | 00 00 08 00 07 00 00 00 0a f3 01 00 04 00 00 00 | ................
0030 | 00 00 00 00 00 00 00 00 01 00 00 00 b7 0d 00 00 | ................
0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0060 | 00 00 00 00 95 32 29 7e b6 0d 00 00 00 00 00 00 | .....2)~........
0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
Inode is Allocated
Group: 0
File mode: 16877
Low 16 bits of Owner Uid: 0
Size in bytes: 1024
Access time: 1455741787
Creation time: 1455741876
Modification time: 1455741876
Deletion Time: 0
Low 16 bits of Group Id: 0
Links count: 2
Blocks count: 4
File flags: 524288
File version (for NFS): 2116629141
File ACL: 3510
Directory ACL: 0
Fragment address: 0
Direct blocks: 127754, 4, 0, 0, 1, 3511, 0, 0, 0, 0, 0, 0
Indirect block: 0
Double indirect block: 0
Triple indirect block: 0
File name | Inode number | Deleted status
Directory block 3511:
. 12
.. 2
xaa 13 Deleted
xab 14 Deleted
xac 15 Deleted
3 . 恢复inode 为12的文件
[root@paylm-164 /]# /usr/local/extundelete/bin/extundelete --restore-inode 12 /l oop/disk_100M
WARNING: Extended attributes are not restored.
Loading filesystem metadata ... 13 groups loaded.
Loading journal descriptors ... 31 descriptors loaded.
Writing output to directory RECOVERED_FILES/
Unable to restore inode 12 (file.12): No undeleted copies found in the journal.
[root@paylm-164 /]# /usr/local/extundelete/bin/extundelete --restore-inode 13 /l oop/disk_100M
WARNING: Extended attributes are not restored.
Loading filesystem metadata ... 13 groups loaded.
Loading journal descriptors ... 31 descriptors loaded.
Restored inode 13 to file RECOVERED_FILES/file.13
[root@paylm-164 /]#
[root@paylm-164 /]#
[root@paylm-164 /]# /usr/local/extundelete/bin/extundelete --restore-inode 14 /l oop/disk_100M
WARNING: Extended attributes are not restored.
Loading filesystem metadata ... 13 groups loaded.
Loading journal descriptors ... 31 descriptors loaded.
Restored inode 14 to file RECOVERED_FILES/file.14
[root@paylm-164 /]# /usr/local/extundelete/bin/extundelete --restore-inode 15 /l oop/disk_100M
WARNING: Extended attributes are not restored.
Loading filesystem metadata ... 13 groups loaded.
Loading journal descriptors ... 31 descriptors loaded.
Restored inode 15 to file RECOVERED_FILES/file.15
[root@paylm-164 /]#
[root@paylm-164 /]#
[root@paylm-164 /]#
[root@paylm-164 /]# mount -o loop /loop/disk_100M /mnt1/loop100M/
[root@paylm-164 /]# ls /mnt1/loop100M/
lost+found test
4. 查看恢复的文件:
[root@paylm-164 /]# ls RECOVERED_FILES/
file.13 file.14 file.15
跟据恢复过程中的信息,将文件重命名回来,根据橙色的文字对照:
原文件名 -->> inod -->> 恢复后文件名
xaa 13 file.13
xab 14 file.14
xac 15 file.15
#mv file.13 /test/xaa
#mv file.14 /test/xab
#mv file.15 /test/xac
done
linux恢复rm删除文件ext4,EXT4中恢复使用rm命令误删除的文件相关推荐
- linux的垃圾箱是哪个文件夹,Ubuntu命令行的垃圾箱Trash CLI,远离 rm 命令误删除重要文件的阴影...
原标题:Ubuntu命令行的垃圾箱Trash CLI,远离 rm 命令误删除重要文件的阴影 作为Linux用户,您可能需要不时从系统中删除文件.我们在删除文件时往往会保持谨慎,特别是在永久删除文件时, ...
- Linux/Ubuntu: 使用 trash-cli 防止 rm 命令误删除重要文件
曾几何时,一条 rm -rf /useless /* 命令干掉了我们需要的文件,也干掉的整个系统, 这是是不是与哭无泪啊. 像这种使用 rm 命令误删除文件的情况,我们会注意,但是我们不能保证百分百的 ...
- 怎么恢复微信删除的聊天记录?如何恢复微信删除内容
怎么恢复微信删除的聊天记录呢?这已经成为我们的热门话题了,很多朋友对于恢复类软件没有过多的了解,微信的聊天记录删除了,就会去找某些商家购买,进行恢复,这种方法不仅安全性没有保障,而且价格普遍偏高,小编 ...
- linux重新识别逻辑卷,linux – 从已删除的LVM逻辑卷恢复ext4文件系统的任何方法?...
前几天,当我在Vmware下的 Linux客户端上扩展磁盘时,我有一个适当的大脑放屁时刻.我将Vmware磁盘文件扩展到所需的大小然后我做了我通常在没有LVM的Linux客户端上做的事情:我删除了LV ...
- Linux中如何恢复rm命令误删除的文件之extundelete编译安装及使用
1.下载extundelete包,安装依赖 我用的是Centos系统,在安装extundelete之前需要安装e2fsprogs,e2fsprogs-libs,e2fsprogs-devel. yum ...
- linux etc目录 删除,干货分享丨如何恢复Linux下误删/etc目录数据
@悬镜安全实验室 前言 对于运维工作者来说,可能最让人担心的,是服务器宕机: 最让人无助的,是被DDOS: 而最让人心惊肉跳的,是rm -rf *这个命令-- 当你执行rm -rf命令时,万一哪个变量 ...
- linux trash命令,Linux/Ubuntu: 使用 trash-cli 防止 rm 命令误删除重要文件
曾几何时,一条 rm -rf /useless /* 命令干掉了我们需要的文件,也干掉的整个系统, 这是是不是与哭无泪啊. 像这种使用 rm 命令误删除文件的情况,我们会注意,但是我们不能保证百分百的 ...
- outlook从服务器中恢复已删除项目,如何在Outlook中恢复已删除的任务
如果我们知道有哪些装机必备的系统工具,那么在Microsoft Outlook中恢复已删除文件的任务就不会显得如此棘手,令人伤神.有几种高效的已删除邮件恢复方式,用户可以使用它们完成Outlook文件 ...
- linux进入文件夹命令,如何在 Linux 中不使用 CD 命令进入目录/文件夹?
众所周知,如果没有 cd 命令,我们无法 Linux 中切换目录.这个没错,但我们有一个名为 shopt 的 Linux 内置命令能帮助我们解决这个问题. shopt 是一个 shell 内置命令,用 ...
- 谷歌标签恢复_避免/从Google惩罚中恢复
谷歌标签恢复 如何从Google Penalty中恢复? (How to Recover from Google Penalty ?) Many webmasters sometimes face a ...
最新文章
- Windows设置软件开机自启动与关闭
- QT教程2:QT5的体系构架
- be sure to bring water with you while studying
- Visiual Studio2012 CLR20r3问题
- 【转载】MyBatis报错Invalid bound statement (not found)
- 为什么苹果内购总是失败_苹果官网送货流程将改革,最快次日达丨iPhone6s 等钉子户终于要换手机了...
- java8 日期api_我们多么想要新的Java日期/时间API?
- 作者:刘大伟(1984-),男,博士,烟台中科网络技术研究所助理研究员。
- POJ1279 Art Gallery 多边形的核
- Oracle 之instant client
- 多线程_C# 多线程技术
- STC51-数码管显示
- 揭秘了!小米透明电视所用处理器为联发科定制
- python机器学习库sklearn——BIRCH聚类
- java编译过程_Java编译运行过程
- DOS专题之基本命令
- ThinkAdmin基本操作
- 1-106兔子繁衍问题
- SkeyeVSS实现监控摄像头进行网页WEB和微信、手机无插件直播点播解决方案
- django3.0+ 使用 xadmin
热门文章
- CMD批处理实现dot命令自动运行更新
- 固态硬盘+机械硬盘安装win10和ubuntu18.04双系统经验总结
- 如何设计qPCR引物序列
- 不义联盟2显示服务器,打开不义联盟2提示网络异常或者连接不上
- QT quick中的登录界面(Rectangle,TextField文本框的使用)
- 用Html5制作 汤姆猫 小游戏
- wordpress插件_2020年5个最佳WordPress电子商务插件比较
- win10很多软件显示模糊_win10自带对录屏软件一直显示目前无法录制,后台录制出现问题怎么办?...
- 猿创征文 | Python 开发工具进化之旅
- MariaDB的延迟开源模式及其BSL许可证介绍(一)