Linux下误删文件应急恢复
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,Linux下误删文件应急恢复 维护中难免遇到状态不好的时候或者新人操作不当,一个rm -f *删除了大量的文件,导致生产重大故障,这个时候我们需要考虑文件恢复,为了能够应对这种情况,在这里讨论一个网上
千家信息网最后更新 2025年11月07日Linux下误删文件应急恢复Linux下误删文件应急恢复 维护中难免遇到状态不好的时候或者新人操作不当,一个rm -f *删除了大量的文件,导致生产重大故障,这个时候我们需要考虑文件恢复,为了能够应对这种情况,在这里讨论一个网上常用的恢复工具:extundelete,该工具支持ext3或者ext4. 1 安装 首先安装好准备包: [root@redhat1 home]# yum install e2fs* --安装extundelete软件的依赖包 [root@redhat1 home]# rpm -aq |grep e2fs --检查软件包是否安装 e2fsprogs-devel-1.41.12-14.el6.i686 e2fsprogs-libs-1.41.12-14.el6.i686 e2fsprogs-1.41.12-14.el6.i686 确认gcc编译工具齐全 gcc+ 开始安装 tar xvf extundelete-0.2.4.tar.bz2 . /configure make make install 2 使用方法 root@localhost bin]# ./extundelete No action specified; implying --superblock. ./extundelete: Missing device name. Usage: ./extundelete [options] [--] device-file Options: --version, -[vV] Print version and exit successfully. --help, Print this help and exit successfully. --superblock Print contents of superblock in addition to the rest. If no action is specified then this option is implied. --journal Show content of journal. --after dtime Only process entries deleted on or after 'dtime'.根据时间点恢复之后的文件。 --before dtime Only process entries deleted before 'dtime'.根据时间点恢复之前的。 Actions: --inode ino Show info on inode 'ino'. --block blk Show info on block 'blk'. --restore-inode ino[,ino,...] Restore the file(s) with known inode number 'ino'. The restored files are created in ./RECOVERED_FILES with their inode number as extension (ie, file.12345). --restore-file 'path' Will restore file 'path'. 'path' is relative to root of the partition and does not start with a '/' The restored file is created in the current directory as 'RECOVERED_FILES/path'. --restore-files 'path' Will restore files which are listed in the file 'path'. Each filename should be in the same format as an option to --restore-file, and there should be one per line. --restore-directory 'path' Will restore directory 'path'. 'path' is relative to the root directory of the file system. The restored directory is created in the output directory as 'path'. --restore-all Attempts to restore everything. -j journal Reads an external journal from the named file. -b blocknumber Uses the backup superblock at blocknumber when opening the file system. -B blocksize Uses blocksize as the block size when opening the file system. The number should be the number of bytes. --log 0 Make the program silent. --log filename Logs all messages to filename. --log D1=0,D2=filename Custom control of log messages with comma-separated Examples below: list of options. Dn must be one of info, warn, or --log info,error error. Omission of the '=name' results in messages --log warn=0 with the specified level to be logged to the console. --log error=filename If the parameter is '=0', logging for the specified level will be turned off. If the parameter is '=filename', messages with that level will be written to filename. -o directory Save the recovered files to the named directory. The restored files are created in a directory named 'RECOVERED_FILES/' by default. ./extundelete: Error parsing command-line options. 3 实验恢复 创建目录 /boot/test 创建测试文件 [root@localhost test]# ls -rlt total 12 -rw-r--r--. 1 root root 21 Oct 9 17:11 1111111111111112.txt -rw-r--r--. 1 root root 13 Oct 9 17:11 1111111111111111.txt -rw-r--r--. 1 root root 24 Oct 9 17:11 1111111111111113.txt 删除文件 rm -rf * 4 恢复 cd /usr/local/bin/ 查看可恢复的文件和目录。 ./extundelete /dev/sda1 --ls --inode 2 直接恢复文件到当前目录。 ./extundelete /dev/sda1 --restore-all 查看当前目录:RECOVERED_FILES 就可以看到删除的文件。 直接恢复指定的文件 ./extundelete /dev/sda1 --restore-file vmlinuz-2.6.32-642.el6.x86_64 直接恢复制定的文件夹 ./extundelete /dev/sda1 --restore-directory test 网上可参考学习 https://my.oschina.net/fufangchun/blog/176550
文件
目录
工具
时候
时间
软件
应急
不当
重大
齐全
不好
使用方法
常用
情况
故障
文件夹
新人
方法
状态
软件包
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
个人使用云服务器能干嘛
数据库字符串型汉字怎么排序
温州dns服务器有响应吗
商业数据库有哪些
思科怎么设置dns服务器
海上服务器
高仿大众点评数据库
安装数据库默认标识
网络安全问题知识竞答
黄埔网络安全建设哪家好
北京海商网络技术有限公司
网络安全宣传信息简报
数据库管理系统的英文介绍
数据库表锁住
服务器光纤网卡怎么插
护苗网络安全课6
软件开发大会2021
数据库记录必须保留
战地一服务器端联是被踢了吗
什么模型强调分阶段软件开发
小程序上线后迁移服务器
传奇神龙帝国怪物数据库
数据库原理的实验
上饶服务器要多少费用
工行杭州软件开发中心 知乎
社区服务器挖矿
去银行软件开发中心工作好吗
鄢陵游戏软件开发在线咨询
普陀区营销软件开发服务保障
迅蓉网络技术工作室
- 上一篇
Last_IO_Error: Fatal error:slave have equal MySQL Server UUIDs原因及解决
最近在虚拟机上部署MySQL主从复制架构的时候,碰到了"Last_IO_Error: Fatal error: The slave I/O thread stops because master an
- 下一篇
Mysql安装时出现could not start the service mysql error:0怎么办
这篇文章主要讲解了"Mysql安装时出现could not start the service mysql error:0怎么办",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢