centOS6.4 extundelete工具恢复rm -rf 删除的目录
PS:补充下,我在fedora 19上运行的时候遇到的一个问题:
[root@localhost extundelete-0.2.]# ./configure
Configuring extundelete 0.2.
configure: error: in `/usr/local/src/extundelete-0.2.':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
查看了下config.log文件发现与gcc-c++有关。所以运行yum -y install gcc-c++这个库后问题解决
总计 kB/s | 8.2 MB :
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : libstdc++-devel-4.8.-.fc19.i686 /
正在安装 : gcc-c++-4.8.-.fc19.i686 /
验证中 : libstdc++-devel-4.8.-.fc19.i686 /
验证中 : gcc-c++-4.8.-.fc19.i686 / 已安装:
gcc-c++.i686 :4.8.-.fc19 作为依赖被安装:
libstdc++-devel.i686 :4.8.-.fc19 完毕!
[root@localhost extundelete-0.2.]# ./configure
Configuring extundelete 0.2.
Writing generated files to disk
[root@localhost extundelete-0.2.]# yum install gcc-c++
首先。Linux下很多人都喜欢用rm -rf去删除目录。但是rm --help提示这是一个非常危险的命令、谨慎用之。
这里公司一台服务器。同事在操作的过程中误删掉一个目录。而且是非常重要的。
尝试恢复cat /etc/redhat-release 查看为rhel4版本。很老了这就有一个问题出现yum无法用。
先用一个ext3grep 工具恢复。但是该工具--help 提示没有针对目录恢复的参数 只有一个all 我尝试用时间戳恢复当时时间段的数据效果不理想、
而且跟要命的是当我查看分区的时候df -aT发现这个删除的目录进入奇迹般的划分在了与/一个分区。0 0这意味着我挂载为只读分区时要杀掉一
切与/根分区有关的进程;所有反复思索后决定一个好的办法:
USB移动硬盘安装一个便携Linux系统,并在其上面安装extundelete工具因为这个工具需要几个包的支持。而rhel4的系统现在yum已经无法使用
安装支持包都很困难。索性放弃。
关于USB移动硬盘系统。与我们用的stat 硬盘安装系统一样。可以用光盘镜像安装选择USB设备为安装设备。或者用虚拟机安装都可以。这里我就
不多说推荐虚拟机Virtual Box和VMware(优点是你有镜像但无法刻盘)。
好了进入centOS6.4后
下载extundelete:wget http://pkgs.fedoraproject.org/repo/pkgs/extundelete/extundelete-0.2.4.tar.bz2/77e626ad31433680c0a222069295d2ca/extundelete-0.2.4.tar.bz2
[root@vbok src]# wget http://pkgs.fedoraproject.org/repo/pkgs/extundelete/extundelete-0.2.4.tar.bz2/77e626ad31433680c0a222069295d2ca/extundelete-0.2.4.tar.bz2
[root@vbok src]# tar jxvf extundelete-0.2..tar.bz2
直接./configure make make install 但我运行./configure时报错:
[root@vbok src]# cd extundelete-0.2.
[root@vbok extundelete-0.2.]# ./configure
Configuring extundelete 0.2.
configure: error: Can't find ext2fs library
提示 ext2fs library 少几个包的支持
[root@vbok extundelete-0.2.]# yum -y install ext2fs
OK 在运行make三部曲
[root@vbok extundelete-0.2.]# ./configure
Configuring extundelete 0.2.
Writing generated files to disk
当然如果你make完后就可以使用这个工具的
[root@vbok extundelete-0.2.]# make
make -s all-recursive
Making all in src
extundelete.cc:: 警告:未使用的参数‘flags’
直接在~/src/extundelete --help
[root@vbok extundelete-0.2.]# src/extundelete --help
或者在运行 make install 这时会安装到/usr/local/bin/extundelete 下
我还是推荐make完就成了。因为假如你要恢复的目录正好是/usr 那你就还需要在./configure下加参数。浪费时间效果一样
OK来演示下恢复吧
[root@vbok /]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/mapper/vg_vbok-gen
25G 541M 23G % /
tmpfs 943M 232K 943M % /dev/shm
/dev/sdb1 485M 36M 424M % /boot
/dev/mapper/vg_vbok-home
20G 172M 19G % /home
/dev/mapper/vg_vbok-opt
11G 156M .9G % /opt
/dev/mapper/vg_vbok-usr
39G .2G 34G % /usr
/dev/sdb3 51G 16K 51G % /vfat
我在/opt下创建了个目录 “1“ 下面有多个子目录和文件。然后我将其删除。
(看看现在的时间)并回到extundelete 安装目录下将opt目录挂载为只读为了保护数据防止重写。
root@vbok /]# cd opt/
[root@vbok opt]# ls
lost+found rh
[root@vbok opt]# date
2013年 10月 14日 星期一 :: CST
[root@vbok opt]# rm -rf
[root@vbok opt]# ls
lost+found rh
[root@vbok opt]# cd /usr/local/src/extundelete-0.2.
[root@vbok extundelete-0.2.]# mount -o remount,ro /dev/mapper/vg_vbok-opt
这里说下我要用到的参数 src/extundelete --help
--restore-directory 'path'
Will restore directory 'path'. 'path' is relative to the
--restore-all Attempts to restore everything.
--after dtime Only process entries deleted on or after 'dtime'.
--before dtime Only process entries deleted before 'dtime'.
第一个是 恢复目录 path为路径后面跟要恢复那个目录的路径
第二个是 恢复所有
第三个是 恢复dtime这个时间戳以后删除的文件
第四个是恢复这个时间戳以前删除的文件 (这里说下,卡时间恢复是非常好用的参数。你可以指定恢复那个时间到那个时间之间的数据)
基本这几个选项就够恢复了,当然还有--restore-files 参数来恢复单个文件。
OK开始
我上面在删除的时间date了下系统时间所以我就来生成下 删除前和删除后的时间戳用来定位我要恢复的目录,然后利用工具恢复删除的目录
[root@vbok extundelete-0.2.]# date -d "2013-10-14 16:43" +%s [root@vbok extundelete-0.2.]# date -d "2013-10-14 16:58" +%s [root@vbok extundelete-0.2.]# src/extundelete /dev/mapper/vg_vbok-opt --after / --before --restore-directory
OK恢复完成,这里要注意的是在用恢复目录选项的时候,后面接的目录是以opt后的目录。也就是说 /dev/mapper/vg-vbox-opt 已经代表了/opt这个目录我们只需要接着写 opt后面的目录 例如要恢复/opt/1/2/3 这个目录 我们后面的路径为 1/2/3 就可以恢复3这个目录了 当然有时间戳指定时间段后就可以用--restore-all恢复这个时间段删除的所有数据了。OK
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... groups loaded.
Loading journal descriptors ... descriptors loaded.
Searching for recoverable inodes in directory ...
recoverable inodes found.
Looking through the directory structure for deleted files ...
recoverable inodes still lost.
[root@vbok extundelete-0.2.]# cd RECOVERED_FILES/
[root@vbok RECOVERED_FILES]# LS
-bash: LS: command not found
[root@vbok RECOVERED_FILES]# ls [root@vbok RECOVERED_FILES]# cd
[root@vbok ]# ls [root@vbok ]# cd /
[root@vbok ]# ls
a
[root@vbok ]# cd ..//c
-bash: cd: ..//c: 不是目录
[root@vbok ]# cd ..//c
数据 完好无损。
在讲/opt这个分区挂载回读写的,不会的可以reboot重启下也可以
centOS6.4 extundelete工具恢复rm -rf 删除的目录的更多相关文章
- centOS6.4 extundelete工具恢复rm -rf 删除的目录[转]
原文:http://www.cnblogs.com/patf/p/3368765.html PS:补充下,我在fedora 19上运行的时候遇到的一个问题: 1 [root@localhost ext ...
- 高性能Linux服务器 第6章 ext3文件系统反删除利器ext3grep extundelete工具恢复rm -rf 误删除的文件
高性能Linux服务器 第6章 ext3文件系统反删除利器ext3grep extundelete工具恢复rm -rf 误删除的文件 只能用于ext3文件系统!!!!!!!高俊峰(高性能Linux ...
- 用extundelete恢复rm -rf删的文件
“慎用rm -rf命令,除非你知道此命令带来的后果.”这是一条Linux用户守则,虽然大多数用户都明白这条语句的含义,但是我觉得还需要完善一下,为这条语句加 上一个使用前提:在你确认自己拥有清醒头脑, ...
- Linux下面误删除文件使用extundelete工具恢复介绍
操作系统版本:CentOS release 6.4 (Final) 软件版本:extundelete-0.2.4.tar.bz2 PS:该软件恢复文件系统仅支持ext2/ext3/ext4 ...
- ubuntu恢复rm -rf误删文件
使用extundelete工具 sudo apt-get install extundelete 恢复操作命令 首先需要umount或者read only 分区 umount /dev/partit ...
- 使用 rm -rf 删除了工程目录,然后从 pycharm 中找了回来
一次惊险的 rm -rf 操作,以后删东西真的要小心,慢点操作 前两天周 4 周 5,写了两天的 python 代码没有提交,昨天晚上删日志目录,先跨目录查看了下日志目录的列表情况:ll ~/logs ...
- [linux] rm -rf删除软链接无权限?
一个很简单的命令,使用频率非常高,但一没注意就会失策. 我将别人盘下的list目录软连接到自己盘中,想要删除时: rm -rf list/ #输入时自然地用tab键补全 结果: 试了多次也删除不了,最 ...
- rm -rf删除过多文件提示参数过长
cd /var/tmp/ find . -name "*.log"|xargs rm -rf "*.log"
- CentOS 恢复 rm -rf * 误删数据(转)
一. 将磁盘分区挂载为只读 这一步很重要,并且在误删除文件后应尽快将磁盘挂载为只读.越早进行,恢复的成功机率就越大. 1. 查看被删除文件位于哪个分区 [root@localhost ~]# mo ...
随机推荐
- 解决angular2页面刷新后报404错误
如果你的angular项目部署到一个tomcat容器里面,localhost:8080是JavaWeb的主页,localhost:8080/driver/login是你angular2项目的登陆地址. ...
- on 在ios下 父对象是body的时候会 不调用
on 用委托的形式绑定事件 在ios下 父对象是body 获取 docment的时候会 不调用 解决方案 在这些元素上加 cursor: pointer;
- 用Wireshark抓包分析超过70秒的请求
超过70秒的请求是通过分析IIS日志发现的: 10.159.63.104是SLB的内网IP. 通过Wireshark抓包分析请求是9:22:21收到的(tcp.stream eq 23080): 09 ...
- 中国IT 未来何在
许久之前,已对国内IT业的一些问题颇有看法,而今又恰逢360与AV-C的纠缠,实在忍不住要发发牢骚.IT在中国,发展不过二十来年,却以迅雷之速横扫各个领域,令人感叹,此成就是不可否认的:然而,发展 ...
- php上传图片---初级版
没有样式,没有淘宝的那种放大截取大小的效果,只是实现了图片上传的功能. 图片超过100k,会出现内部错误服务器错误,需要手动更改配置文件里的MaxRequestLen属性. 下面粘上代码: <? ...
- Bootstrap系列 -- 14. 表单控件输入框input
每一个表单都是由表单控件组成.离开了控件,表单就失去了意义.接下来的我们简单的来了解Bootstrap框架中表单控件的相关知识. 单行输入框,常见的文本输入框,也就是input的type属性值为tex ...
- SpringMVC实现Restful风格的WebService
1.环境 JDK7 MyEclipse2014 tomcat8 maven 3.3.3 spring4.1.4 2.创建maven工程 使用MyEclipse创建maven工程的方式可以参考这篇博文( ...
- Red Hat Linux9命令行--修改补充中
1.使用rpm工具安装应用软件:rpm [选项] [软件包名] 常用的参数及含义如下图所示: 2.编译安装应用软件 (1).tar.gz和.tgz使用如下的命令: [root@myhost ro ...
- hdu1305 字典树
这题我开始想的简单了,WA一次,然后看disscuss里有人说输入时长度从小到大的,然后我信了.然后开始while(1) WA;然后我尝试先放如数组.后来对了: discuss里面果然不能太相信. 根 ...
- poj2485&&poj2395 kruskal
题意:最小生成树的最大边最小,sort从小到大即可 poj2485 #include<stdio.h> #include<string.h> #include<algor ...