http://extundelete.sourceforge.net/options.html

误删除/usr/share目录
因此考虑恢复目录
过程如下:
1.选用extundelete软件来进行恢复,源码编译安装
[root@84-monitor src]# bunzip2 extundelete-0.2.4.tar.bz2
[root@84-monitor src]# tar xf extundelete-0.2.4.tar
tar -xjf extundelete-0.2.0.tar.bz2
下面这是第一个警告,不予理睬。
[root@84-monitor extundelete-0.2.4]# less README
WARNING: terminal is not fully functional

必须先umount要恢复文件的分区或者把分区改为只读模式,命令:mount –o remout,ro 分区(例如:dev/hda1)或者
mount -n -r -o remount /db  最好尽快将所在分区修改为只读方式,防止数据被覆盖使用。

[root@84-monitor extundelete-0.2.4]# yum install gcc-c++
Traceback (most recent call last):
  File "/usr/bin/yum", line 28, in <module>
    import yummain
ImportError: No module named yummain

[root@84-monitor extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
configure: error: in `/usr/local/src/extundelete-0.2.4':
configure: error: C++ compiler cannot create executables
See `config.log' for more details

[root@84-monitor src]# rpm -ivh libstdc++-devel-4.4.7-11.el6.x86_64.rpm libstdc++-4.4.7-11.el6.x86_64.rpm gcc-c++-4.4.7-11.el6.x86_64.rpm --replacefiles

[root@84-monitor extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
configure: error: Can't find ext2fs library

[root@84-monitor packages]# ll
total 964
-rw-r--r--. 1 root root 566700 2014-10-18 04:00 e2fsprogs-1.41.12-21.el6.x86_64.rpm
-rw-r--r--. 1 root root 164100 2014-10-18 04:02 e2fsprogs-devel-1.41.12-21.el6.x86_64.rpm
-rw-r--r--. 1 root root 123728 2014-10-18 04:01 e2fsprogs-libs-1.41.12-21.el6.x86_64.rpm
-rw-r--r--. 1 root root  38088 2014-10-18 04:02 libcom_err-1.41.12-21.el6.x86_64.rpm
-rw-r--r--. 1 root root  33232 2014-10-18 04:01 libcom_err-devel-1.41.12-21.el6.x86_64.rpm
-rw-r--r--. 1 root root  42468 2014-10-18 04:01 libss-1.41.12-21.el6.x86_64.rpm
[root@84-monitor packages]# rpm -ivh * --replacefiles
Preparing...                ########################################### [100%]
        package libcom_err-1.41.12-21.el6.x86_64 is already installed
        package e2fsprogs-libs-1.41.12-21.el6.x86_64 is already installed
        package libcom_err-devel-1.41.12-21.el6.x86_64 is already installed
        package libss-1.41.12-21.el6.x86_64 is already installed
        package e2fsprogs-1.41.12-21.el6.x86_64 is already installed
[root@84-monitor packages]# rpm -ivh e2fsprogs-devel-1.41.12-21.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:e2fsprogs-devel        ########################################### [100%]
[root@84-monitor packages]# cd ../extundelete-0.2.4
[root@84-monitor extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
Writing generated files to disk

[root@84-monitor extundelete-0.2.4]# make
make -s all-recursive
Making all in src
extundelete.cc:571: warning: unused parameter
You have new mail in /var/spool/mail/root
[root@84-monitor extundelete-0.2.4]# make install
Making install in src
  /usr/bin/install -c extundelete '/usr/local/bin'

[root@84-monitor extundelete-0.2.4]# extundelete /dev/mapper/VolGroup-lv_root  --inode 651608

[root@84-monitor extundelete-0.2.4]# extundelete /dev/mapper/VolGroup-lv_root --restore-directory /usr/share
NOTICE: Extended attributes are not restored.
WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set.
The partition should be unmounted to undelete any files without further data loss.
If the partition is not currently mounted, this message indicates
it was improperly unmounted, and you should run fsck before continuing.
If you decide to continue, extundelete may overwrite some of the deleted
files and make recovering those files impossible.  You should unmount the
file system and check it with fsck before using extundelete.
Would you like to continue? (y/n)
y
Loading filesystem metadata ... 117 groups loaded.
Loading journal descriptors ... 30051 descriptors loaded.
Searching for recoverable inodes in directory /usr/share ...
1087 recoverable inodes found.
Looking through the directory structure for deleted files ...
Unable to restore inode 656184 (usr/share/policycoreutils-2.0.83): Space has been reallocated.
Unable to restore inode 656716 (usr/share/fuse-2.8.3): Space has been reallocated.
797 recoverable inodes still lost.

[root@84-monitor usr]# pwd
/usr
[root@84-monitor usr]# cp  -r /usr/local/src/extundelete-0.2.4/RECOVERED_FILES/usr/share/ ./

拷贝其它系统中的/usr/share/yum-plugins和/usr/share/yum-cli到本系统下,yum就可以用了
[root@84-monitor share]# yum search wget
Traceback (most recent call last):
  File "/usr/bin/yum", line 28, in <module>
    import yummain
ImportError: No module named yummain
[root@84-monitor share]# cd yum-
yum-3.2.29/                      yum-plugin-fastestmirror-1.1.30/

[root@84-monitor src]# cd /usr/share/yum-
yum-3.2.29/                      yum-cli/                         yum-plugin-fastestmirror-1.1.30/ yum-plugins/

有时候删除了大量的数据量,其中很多数据都是没用的,我们仅需要恢复其中的一部分数据,此时,如果采用恢复全部数据的办法,不但耗时,而且浪费资源,在这种情况下,就需要采用另外的一种恢复机制有选择地恢复,extundelete提供了“—after”“和”--before“参数,可以通过指定某个时间段,进而只恢复这个时间段内的数据。
[root@cloud1 mnt]# extundelete  --after 1379146740 --restore-all /dev/sdc1

在数据被误删除后,第一时间要做的是卸载被删除数据所在的磁盘或磁盘分区,如果是系统根分区的数据遭到误删除,就需要将系统进入单用户,并且将根分区以只读模式挂载。这样做的原因很简单,因为将文件删除后,仅仅是将文件的inode结点中的扇区指针清零,实际文件还存储在磁盘上,如果磁盘以读写模式挂载,这些已删除的文件的数据块就可能被操作系统重新分配出去,在这些数据块被新的数据覆盖后,这些数据就真的丢失了,恢复工具也回力无天。所以,以只读模式挂载磁盘可以尽量降低数据块中数据被覆盖的风险,以提高恢复数据成功的比率。

2.卸载磁盘分区
在将数据误删除后,立刻需要做的就是卸载这块磁盘分区:
[root@cloud1 data]#cd /mnt
[root@cloud1 mnt]# umount /data
3.查询可恢复的数据信息
通过extundelete命令可以查询/dev/sdc1分区可恢复的数据信息:
[root@cloud1 /]# extundelete  /dev/sdc1  --inode 2

在Linux下,基于开源的数据恢复工具有很多,常见的有debugfs、R-Linux、ext3grep、extundelete等,比较常用的有ext3grep和extundelete,这两个工具的恢复原理基本一样,只是extundelete功能更加强大,本文重点介绍extundelete的使用。

extundelete的恢复原理

在介绍使用extundelete进行恢复数据之前,简单介绍下关于inode的知识。在Linux下可以通过“ls –id”命令来查看某个文件或者目录的inode值,例如查看根目录的inode值,可以输入:
[root@cloud1 ~]# ls -id  /
2 /
由此可知,根目录的inode值为2。
在利用extundelete恢复文件时并不依赖特定文件格式,首先extundelete会通过文件系统的inode信息(根目录的inode一般为2)来获得当前文件系统下所有文件的信息,包括存在的和已经删除的文件,这些信息包括文件名和inode。然后利用inode信息结合日志去查询该inode所在的block位置,包括直接块,间接块等信息。最后利用dd命令将这些信息备份出来,从而恢复数据文件。

根分区只读

两块硬盘做了raid0,结果在linux使用过程中(怀疑由于突然断电所致),根分区成了只读,任何写操作都不能执行,ls,df等读操作可以进行,系统也不能在命令行下关机,按电源键强关以后,不能启动。

http://www.ha97.com/5428.html

重启系统后使用root进入单用户模式,运行
fsck.ext3 -y /dev/vda3
说明:ext3的文件系统使用fsck.ext3,ext4文件系统使用fsck.etx4。/dev/vda3是系统/根分区。运行完毕后,reboot重启系统就恢复正常。20多台出问题的都是这样修复的,无失败案例。fsck.ext3开始进入扫描、修正文件系统,这个过程有时很快,有时比较长,中间有数次停顿的过程,只需等待即可,千万不要以为死机而重启服务器。修正完文件系统后,如果没有提示重启系统,也需要reboot来重启系统。

fsck不仅可以对文件系统进行扫描,还能修正文件系统的一些问题。注意的是fsck扫描文件系统时一定要在单用户模式、修复模式或把设备umount后进行。建议在单用户模式下运行。如果扫描正常运行中的系统,会造成系统文件损坏。

条件许可的话建议文件系统都用ext4,fsck修复文件系统的速度和ext3不是一个等级,T级以上的ext3分区,fsck修复的时间让人崩溃

[root@localhost ~]# mount -o remount, rw /

[root@localhost /]# hdparm /dev/mapper/VolGroup00-LogVol00

那就看下hdparm /dev/sda6 看readonly tag是0/1
手动设定 hdparm -r 0 /dev/sda6

数据恢复-extundelete的更多相关文章

  1. Linux下数据恢复软件extundelete

    extundelete软件专门解决意外删除事件的,有时候不小心 rm -rf * 就可能毁掉有用的数据.因此就出现了这个恢复工具,但这个工具也不是万能的,删除数据后一定要停止所以的写操作.以免Inod ...

  2. Linux下高效数据恢复软件extundelete应用实战

    作为一名运维人员,保证数据的安全是根本职责,所以在维护系统的时候,要慎之又慎,但是有时难免会出现数据被误删除的情况,在这个时候改如何快速.有效地恢复数据呢?本文我们就来介绍一下Linux系统下常用的几 ...

  3. 数据恢复软件Extundelete

    数据恢复软件Extundelete介绍 一.概述 作为一名运维人员,保证数据的安全是根本职责,所以在维护系统的时候,要慎重和细心,但是有时也难免发生出现数据被误删除的情况,这个时候该如何快速.有效地恢 ...

  4. Extundelete 数据恢复

    Extundelete 数据恢复 “rm -rf /*” 是我们经常使用的命令,操作不慎全盘接蹦,从删库到跑路,身为过来人的我们都经历过rm带来的痛苦. 不要慌,当我们有了Extundelete就可以 ...

  5. LINUX使用extundelete进行数据恢复

    从删库到跑路不是一句笑话,不小心误删除操作很容易造成整个公司业务崩溃.所以真的误删除了,第一时间就是赶紧停机,不要再进行任何写入操作,把这块磁盘挂载到其他机器进行数据恢复 这里我们介绍一下使用 LIN ...

  6. extundelete数据恢复

    需要安装的依赖包: 1. e2fsprogs软件包已安装2. e2fsprogs-libs软件包已安装3. e2fsprogs-devel软件包已安装4. gcc软件包已安装5. gcc-c++ 软件 ...

  7. 数据恢复软件extundelete介绍

    linux下文件系统一般由文件名.Inode.Block三部分组成.当一个用户在Linux系统中试图访问一个文件时,系统会先根据文件名去查找它的inode,看该用户是否具有访问这个文件的权限.如果有, ...

  8. 数据恢复软Extundelete

    1>概述  作为一名运维人员,保证数据的安全是根本职责,所以在维护系统的时候,要慎重和细心,但是有时也难免发生出现数据被误删除的情况,这个时候该如何              快速.有效地恢复数 ...

  9. extundelete实现Linux下文件/文件夹数据恢复!

    我用的是Centos系统,在安装extundelete之前需要安装e2fsprogs,e2fsprogs-libs,e2fsprogs-devel. 这里用:yum install e2fsprogs ...

随机推荐

  1. Mifare Classic Tool(MCT)汉化版

    2.0.4 到 2.0.6的更改: 注意:本汉化版本可能不稳定,与此发生的一切后果与作者和汉化者无关. Version : * Bugfix: Fixed crash which occurred i ...

  2. 极客DIY:RFID飞贼打造一款远距离渗透利器

    本文使用最新的渗透工具RFID飞贼(Tastic RFID Thief)和RFID感应破解技术来获取一些拥有安防的建筑物的访问权限. Tastic RFID Thief是一个无声远距离RFID读卡器, ...

  3. 【LeetCode】Best Time to Buy and Sell Stock IV

    Best Time to Buy and Sell Stock IV Say you have an array for which the ith element is the price of a ...

  4. iOS 微信 音频 视频自动播放

    iOS 微信 音频 视频自动播放 http://www.w3ctech.com/topic/1165

  5. tracking 问题解决

    1.dir,或者C++函数读文件名,不推荐.搞乱了名字 2. matio读写矩阵

  6. SVM学习笔记

    一.SVM概述 支持向量机(support vector machine)是一系列的监督学习算法,能用于分类.回归分析.原本的SVM是个二分类算法,通过引入“OVO”或者“OVR”可以扩展到多分类问题 ...

  7. CMOS、BIOS

    CMOS主要的功能为记录主板上面的主要参数,包括系统时间.CPU电压与频率.各项设备的I/O地址与IRQ等,由于这些数据的记录要花费电力,因此主板上面才有电池. BIOS为写入到主板上某一块闪存或EE ...

  8. Linux下软件包的多种安装方式

    源码包安装 在Linux下的很多软件都是通过源码包方式发布的,虽然相对于二进制软件包,配置和编译起来繁琐点,但是它的可移植性却好得多,针对不同的体系结构,软件开发者往往仅需发布同一份源码包,不同的最终 ...

  9. ZSDR100 跑原材料MRP

    *&---------------------------------------------------------------------**& Report ZSDR100*&a ...

  10. ZOJ 1078 Palindrom Numbers

    原题链接 题目大意:判断一个数是不是palindrom.不限于十进制,可以在任何进制下判断. 解法:还好,数字的范围不大,int类型足够搞定.方法就是从2进制开始,先把数字转换成2进制,判断是否对称, ...