使用 ext3grep 恢复数据试验成功 笔记
 
来源:  Linux论坛  日期: 2009.07.07 10:03 (共有条评论)  我要评论
 
# software download address : [url]http://code.google.com/p/ext3grep/downloads/list[/url]
# 1、安装 cd /opt wget [url]http://ext3grep.googlecode.com/files/ext3grep-0.10.1.tar.gz[/url] tar -zxf ext3grep-0.10.1.tar.gz cd ext3grep-0.10.1 ./configure make make install
# 2、制造分区 mkdir /home/sheng cd /home/sheng dd if=/dev/zero of=file count=102400 mkfs.ext3 file # !!!!按Y继续 mount -o loop /home/sheng/file /mnt/
# 可以看到已经挂上去了 df -h
# 写入数据到 /mnt mkdir /mnt/del echo 1 > /mnt/del/1 echo 2 > /mnt/del/2 echo 3 > /mnt/del/3
# 删除数据 rm -rf /mnt/del
# 3、开始恢复 # 卸载文件所在的分区 /home/sheng/file umount /home/sheng/file # 查看 df -h
# 扫描分区 ext3grep /home/sheng/file --ls --inode 2
- - - - -
[root@db1 sheng]# ext3grep /home/sheng/file --ls --inode 2 Running ext3grep version 0.10.1 Number of groups: 7 Loading group metadata... done Minimum / maximum journal block: 447 / 4561 Loading journal descriptors... sorting... done The oldest inode block that is still in the journal, appears to be from 12454502                                                                                             09 = Sat Jun 20 06:23:29 2009 Number of descriptors in journal: 17; min / max sequence numbers: 2 / 3 Inode is Allocated Finding all blocks that might be directories. D: block containing directory start, d: block containing more directory entries. Each plus represents a directory start that references the same inode as a direc                                                                                             tory start that we found previously.
Searching group 0: DDD++ Searching group 1: Searching group 2: Searching group 3: Searching group 4: Searching group 5: Searching group 6: Writing analysis so far to 'file.ext3grep.stage1'. Delete that file if you want                                                                                              to do this stage again. Result of stage one:   3 inodes are referenced by one or more directory blocks, 2 of those inodes are                                                                                              still allocated.   1 inodes are referenced by more than one directory block, 1 of those inodes is                                                                                              still allocated.   0 blocks contain an extended directory. Result of stage two:   2 of those inodes could be resolved because they are still allocated. All directory inodes are accounted for!
Writing analysis so far to 'file.ext3grep.stage2'. Delete that file if you want                                                                                              to do this stage again. The first block of the directory is 433. Inode 2 is directory "". Directory block 433:           .-- File type in dir_entry (r=regular file, d=directory, l=symlink)           |          .-- D: Deleted ; R: Reallocated Indx Next |  Inode   | Deletion time                        Mode        File nam                                                                                             e ==========+==========+----------------data-from-inode------+-----------+========                                                                                             =    0    1 d       2                                         drwxr-xr-x  .    1    2 d       2                                         drwxr-xr-x  ..    2  end d      11                                         drwx------  lost+fou                                                                                             nd    3  end d    5497  D 1245450214 Sat Jun 20 06:23:34 2009  drwxr-xr-x  del [root@db1 sheng]#
- - - - -
# 查询 ext3grep /home/sheng/file --ls --inode 2
# 恢复单个 仅目录 里面的文件恢复失败 .. ext3grep /home/sheng/file --restore-file del --depth del
# 恢复目录里面的一个文件 ext3grep /home/sheng/file --restore-file del/1
# 恢复所有文件 ext3grep /home/sheng/file --restore-all

点击下载软件:ext3grep
1. 查看所需的相关库
[root@ns2 ~]# rpm -qa |grep e2fsprogs
e2fsprogs-libs-1.39-8.el5
e2fsprogs-1.39-8.el5
e2fsprogs-devel-1.39-8.el5

注:RHEL4下没有libs程序,但依然可以安装ext3grep 0.7.0 必须要有e2fsprogs-libs,不然在后面ext3grep的安装会有问题。
2.查看一下分区情况: [root@ns2 ~]# df –h

3. 需要软件 http://code.google.com/p/ext3grep/downloads/list 先下载软件 [root@ns2 ~]# cd /root/src/ [root@ns2 src]#  wget  http://ext3grep.googlecode.com/files/ext3grep-0.6.0.tar.gz  src 注:作者已下载过不再下载
4.安装ext3grep A.先挂载光盘

B.安装步骤:  1.[root@ns2 ~]# tar zxvf ext3grep-0\[1\].10.1.tar.gz  –C  /usr/src  <将文件解压到/usr/src目录下> 2.[root@ns2 ~]# cd /usr/src/ext3grep-0.10.1 ->  <进入目录中> 3.[root@ns2 ~]#  ./configure      <配置> 4.[root@ns2 ~]# make && make install  <编译并安装>

5.为方便实验,我们可以模拟一个出来,下面是模拟步骤: a.      #  mkdir  /data/ b.      #  cd /data/ c.      #  dd  if=/dev/zero  of=disk1  count=2048000 d.      #  mkfs.ext3  disk1 e.      #  mkdir  -p  /dfs/a f.       #  mount  -o  loop  /data/disk1  /asd/a

如图,已建立一个模拟分区/data/disk1
6./asd/a下新建文件beijing shanghai
7.后将beijingshanghai 文件删除

8. 文件没有了然后我们来恢复: 首先必须umount掉误删除数据的分区: [root@ns2 ~]# umount /data/disk1 [root@ns2 ~]# df –h

9. 确认卸载,然后使用ext3grep来恢复。 [root@ns2 ~]# ext3grep  /data/disk1  --ls  --inode 2 这里会创建扫描分区

从图中可以看到被删除的beijing,shanghai两个文件
10.恢复数据 [root@ns2 ~]# ext3grep  /data/disk1 --restore-file  shanghai
数据成功恢复 [root@ns2 ~]# ext3grep  /data/disk1 --restore-file  Beijing
11.[root@ns2 ~]# ls -la RESTORED_FILES/

注:被恢复的数据默认恢复到RESTORED_FILES/目录下
12.在RESTORED_FILES下的成功恢复的文件或目录可以做任意操做,作者将其又放回到了原位置

注:至此所有操做已做完,如果数据在其他分区中,同样卸载误删除数据的分区,执行和以上操作相同的恢复步骤!

使用 ext3grep 恢复数据试验成功 笔记的更多相关文章

  1. MySQL学习(三)主备分库分表和恢复数据 --- 2019年2月

    1.MySQL主备切换 readonly 设置对超级(super)权限是无效的,而用于同步更新的线程,就拥有超级权限. 建议在做主备数据库的时候,将备用数据库设置为只读.(反向用readonly来判断 ...

  2. Ubantu 使用extundelete恢复数据

    所以在维护系统的时候,要慎之又慎,但是有时难免会出现数据被误删除的情况,在这个时候改如何快速.有效地恢复数据呢?本文我们就来介绍一下Linux系统下常用的几个数据恢复工具. 一.如何使用“rm -rf ...

  3. Linux误删文件后恢复数据

    在Linux下,基于开源的数据恢复工具有很多,常见的有debugfs.R-Linux.ext3grep.extundelete等,比较常用的有ext3grep和extundelete,这两个工具的恢复 ...

  4. ORACLE恢复数据

    ORACLE恢复删除表或表记录 一:表的恢复      对误删的表,只要没有使用PURGE永久删除选项,那么从flash back区恢复回来希望是挺大的.一般步骤有: 1.从flash back里查询 ...

  5. 不小心删除数据--利用MySQL的binlog恢复数据

    MySQL Binary Log也就是常说的bin-log, ,是mysql执行改动产生的二进制日志文件,其主要作用有两个: * 数据回复 * 主从数据库.用于slave端执行增删改,保持与maste ...

  6. mysql使用二进制日志恢复数据

    一.恢复到某个二进制文件 1.开启二进制日志 在mysqld的配置节点下添加如下配置 log-bin="E:/Mysql57BinLog/binlog"(windows下的路径,l ...

  7. 转:SqlServer2008误操作数据(delete或者update)后恢复数据

    Sqlserver2008误操作数据(delete或者update)后恢复数据(转) 实际工作中,有时会直接在数据库中操作数据,比如对数据进行delete或者update操作,当进行这些操作的时候,如 ...

  8. SqlServer2008误操作数据(delete或者update)后恢复数据

    实际工作中,有时会直接在数据库中操作数据,比如对数据进行delete或者update操作,当进行这些操作的时候,如果没有加上where条件或者where条件不合理,那么导致的结果可想而知,如果操作的又 ...

  9. 金蝶KIS专业版替换SXS.dll 遭后门清空数据被修改为【恢复数据联系QQ 735330197,2251434429】解决方法 修复工具。

    金蝶KIS专业版 替换SXS.dll 遭后门清空数据(凭证被改为:恢复数据联系QQ 735330197,2251434429)恢复解决方法. [客户名称]:山东青岛福隆发纺织品有限公司 [软件名称]: ...

随机推荐

  1. .net+easyui系列--datagrid

    加载CSS <link href="../../Public/easyui/SiteEasy.css" rel="stylesheet" type=&qu ...

  2. 为当前的div 动态添加一个样式

    $("#target").addClass("newClass");

  3. [Mime] MimeHeaders--MimeHeader帮助类 (转载)

    点击下载 MimeHeaders.rar 这个类是关于Mime的Headers类看下面代码吧 /// <summary> /// 类说明:Assistant /// 编 码 人:苏飞 // ...

  4. java输入输出流(内容练习)

    1,编写一个程序,读取文件test.txt的内容并在控制台输出.如果源文件不存在,则显示相应的错误信息. package src; import java.io.File; import java.i ...

  5. CSS-id选择器-类选择器-属性选择器

    Css基础 CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明. 选择器通常是您需要改变样式的 HTML 元素. 每条声明由一个属性和一个值组成. 每个属性有一个值.属性和值被冒号分开. 下 ...

  6. JS常用的7中跨域方式总结

    javascript跨域有两种情况:  1.基于同一父域的子域之间,如:a.c.com和b.c.com  2.基于不同的父域之间,如:www.a.com和www.b.com  3.端口的不同,如:ww ...

  7. java经典题目练习-第八题简单实现方式...

    *[程序8]*题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字.* 例如2+22+222+2222+22222(此时共有5个数相加),几个数相加有键盘控制. 思考: 对于以上 ...

  8. 原始的JDBC操作

    -----------------------------根据配置文件---------------------------- package cn.gdpe.jdbc; import java.io ...

  9. 实现Action(含Action访问ServletAPI)

    Action里是否包含实例变量不重要,重要的是包含setter和getter方法. Action可用于封装请求参数和处理结果.jsp中使用struts2输出:<s:property value= ...

  10. go和swift

    你生命中的有些东西终究会失去,比如我住了6年的陈寨,这个聚集了郑州十几万IT民工的地方,说拆就拆了.再比如我玩了3年的坦克英雄,这个带给我太多快乐的游戏,说停就停了. 编程对我而言是种爱好,我上学6年 ...