尝试去恢复被删除的数据,虽然失败了,下次也算点经验了

   2016-11-13 0
核心提示:博客的附件全部丢失,我很郁闷!里面很多图都是我花了很长时间画出来的。某一张图可能就耗费我2个多小时。第一次遇到 linux 需要恢复有价值的数据,处理的晚了点,也没经验,不知道和我新建了同名目录是否有关系,导致没有恢复成功,但是恢复了刚刚前一会删除

博客的附件全部丢失,我很郁闷!里面很多图都是我花了很长时间画出来的。某一张图可能就耗费我2个多小时。第一次遇到 linux 需要恢复有价值的数据,处理的晚了点,也没经验,不知道和我新建了同名目录是否有关系,导致没有恢复成功,但是恢复了刚刚前一会删除的软件包,所以立即恢复,可能还是有希望的。

参考这篇: http://ixdba.blog.51cto.com/2895551/1566856/

yum install e2fsprogs* -y
[root@VM_132_97_centos soft]#tar jxvf  extundelete-0.2.4.tar.bz2
[root@VM_132_97_centos soft]# cd extundelete-0.2.4/
[root@VM_132_97_centos extundelete-0.2.4]# ./configure 
Configuring extundelete 0.2.4
Writing generated files to disk
[root@VM_132_97_centos extundelete-0.2.4]# ls
acinclude.m4  autogen.sh  config.h.in  config.status  configure.ac  install-sh  Makefile     Makefile.in  README  stamp-h1
aclocal.m4    config.h    config.log   configure      depcomp       LICENSE     Makefile.am  missing      src
[root@VM_132_97_centos extundelete-0.2.4]# make
make -s all-recursive
Making all in src
extundelete.cc:571: 警告:未使用的参数‘flags’
[root@VM_132_97_centos extundelete-0.2.4]# make install
Making install in src
  /usr/bin/install -c extundelete '/usr/local/bin'
[root@VM_132_97_centos ~]# umount /dev/xvdb1 
umount: /data: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@VM_132_97_centos ~]# fuser -m /data
/data:                6338c  8128cm  9207 14643
[root@VM_132_97_centos ~]# ps aux|grep 9207
root      9207  0.0  0.1 117408  5804 ?        Ss   Oct15   0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)                                                                    
root     30430  0.0  0.0 103184   860 pts/1    R+   13:50   0:00 grep 9207
[root@VM_132_97_centos ~]# service php-fpm stop
Gracefully shutting down php-fpm . done
[root@VM_132_97_centos ~]# fuser -m /data
/data:                6338c  8128cm 14643
[root@VM_132_97_centos ~]# ps aux|grep 14643
root     14643  0.0  0.0 202692  3832 ?        Ss   Nov10   0:00 php-fpm: master process (/usr/local/php5/etc/php-fpm.conf)                                                                      
root     30493  0.0  0.0 103184   856 pts/1    R+   13:51   0:00 grep 14643
[root@VM_132_97_centos ~]# service php5-fpm stop
Gracefully shutting down php-fpm . done
[root@VM_132_97_centos ~]# fuser -m /data
/data:                6338c  8128cm
[root@VM_132_97_centos ~]# umount /data
umount: /data: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@VM_132_97_centos ~]# ps aux|grep 6338
root      6338  0.0  0.1 133540  6044 ?        Ssl  Sep30   2:34 /usr/local/redis/bin/redis-server 127.0.0.1:6379                 
root     30765  0.0  0.0 103184   852 pts/1    R+   13:52   0:00 grep 6338
[root@VM_132_97_centos ~]# service redis stop

卸载的时候发现磁盘繁忙,只能先把各种服务都停了。

[root@VM_132_97_centos ~]# fuser -m /data
[root@VM_132_97_centos ~]# umount /data

只看到了刚刚删除的安装包,昨天被误删的东西并没有恢复

[root@VM_132_97_centos mnt]# extundelete /dev/xvdb1 --restore-all
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 400 groups loaded.
Loading journal descriptors ... 26227 descriptors loaded.
Searching for recoverable inodes in directory / ... 
15 recoverable inodes found.
Looking through the directory structure for deleted files ... 
Unable to restore inode 650452 (svndata/mengkang/db/txn-protorevs/1590-18h.rev): Space has been reallocated.
Block 11829931 is allocated.
Failed to restore inode 2950453 to file RECOVERED_FILES/soft/extundelete-0.2.4.tar.bz2:Some blocks were allocated.
10 recoverable inodes still lost.
[root@VM_132_97_centos mnt]# ls
RECOVERED_FILES
[root@VM_132_97_centos mnt]# cd RECOVERED_FILES/
[root@VM_132_97_centos RECOVERED_FILES]# ls
file.650456  file.671955  file.671956  file.671957  file.671958  file.671960  file.671961  file.671962  file.671963  file.671964  soft  svndata  WTEST.TMP
[root@VM_132_97_centos RECOVERED_FILES]# ll
总用量 52
-rw-r--r-- 1 root root    5 11月 11 13:56 file.650456
-rw-r--r-- 1 root root  148 11月 11 13:56 file.671955
-rw-r--r-- 1 root root   70 11月 11 13:56 file.671956
-rw-r--r-- 1 root root    4 11月 11 13:56 file.671957
-rw-r--r-- 1 root root  102 11月 11 13:56 file.671958
-rw-r--r-- 1 root root  137 11月 11 13:56 file.671960
-rw-r--r-- 1 root root 1022 11月 11 13:56 file.671961
-rw-r--r-- 1 root root  275 11月 11 13:56 file.671962
-rw-r--r-- 1 root root  474 11月 11 13:56 file.671963
-rw-r--r-- 1 root root  107 11月 11 13:56 file.671964
drwxr-xr-x 2 root root 4096 11月 11 13:56 soft
drwxr-xr-x 3 root root 4096 11月 11 13:56 svndata
-rw-r--r-- 1 root root 4096 11月 11 13:56 WTEST.TMP
[root@VM_132_97_centos RECOVERED_FILES]# cd soft/
[root@VM_132_97_centos soft]# ls
extundelete-0.2.4.tar.bz2.part
 
标签: Linux命令
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

  • 每天一条linux命令——halt
    halt命令用来关闭正在运行的Linux操作系统。halt命令会先检测系统的runlevel,若runlevel为0或6,则关闭系统,否则即调用shutdown来关闭系统。 语法:halt(选项)选项:-d:不要在wtmp中记录;-f:不论目前的runlevel为何,不调用shutdown即强制关闭系统;-i:
    02-10
  • 几个linux命令查看堆栈内存问题 几个linux命令
      公司编写代码,发现整个在程序里面调用system时候总是失败,原因是can't allocate memory ,根本原因不是内存不足,而是堆栈内存不够。使用ulimit -s 2048后有所好转但是发现一旦系统进程开启多了后仍然会挂。后来使用objdump -x 后发现了原因有个动态库
    02-09
  • Linux命令总结--rm命令 linux的rmp命令
    (来源于http://www.cnblogs.com/xqzt/p/5398919.html)1、命令简介rm(Remove file 删除目录或文件)删除文件,对于链接文件,只是删除整个链接文件,而原有文件保持不变。新手在删除文件之前一定要知道这些:很重要1.可以用mv代替rm的绝对不要用rm,不要着急
    02-09
  • Linux命令行批量创建目录详解 linux创建目录
    以前一直用-p创建目录链,觉得很方便了。在空目录/opt/app/myapp里创建src,再创建main,再创建javamkdir -p /opt/app/myapp/src/main/java没想到还可以这样玩##¥%……*(root@vm1:~/tmp# mkdir -p src/{{main,test}/{java,resources},main/webapp}root@vm1:
    02-09
  • Linux命令之乐--script和scriptplay
    script和scriptplay可以把终端会话记录到一个文件中,可以用来制作命令行教学视屏。 开始录制会话[root@new test]# script -t 2timing.log -a output.sessionScript started, file is output.session[root@new test]# echo hellohello[root@new test]# echo
    02-09
  • java 开发常用的Linux命令
    1.查找文件 find / -name filename.txt 根据名称查找/目录下的filename.txt文件。find . -name "*.xml" 递归查找所有的xml文件find . -name "*.xml" |xargs grep "hello world" 递归查找所有文件内容中包含hello world的xml文件grep -H 'spring' *.xml 查找所
    02-09
  • 常用Linux命令整理 Linux常用命令总结
    常用Linux命令整理常见系统命令export 查看或修改环境变量# 例:临时修改命令提示符为字符串$export PS1=$# 例:临时修改命令提示符显示系统时间 时间使用\t 表示export PS1="[\u@\h \t \W]\$"man 查看linux系统的手册# 例:查看ls命令如何使用man ls # 回车
    02-09 Linux
  • linux命令行—《命令行快速入门》 linux常用命令csdn
    linux命令行—《命令行快速入门》 linux常用命
    pwd print working directory 打印工作目录hostname my computer's network name 电脑在网络中的名称mkdir make directory 创建路径cd change directory 改变路径ls list directory 列出路径下的内容rmdir remove directory 删除路径pushd push directory 推
    02-09
  • Linux命令(五) 五个常用的linux命令
    Linux命令(五) 五个常用的linux命令
    jenkins触发钉钉报警机制1、安装钉钉插件钉钉报警需要安装Ding Talk插件,支持钉钉报警2、打开钉钉创建钉钉机器人2.1选择机器人类型——自定义2.2添加机器人2.3填写机器人信息填写机器人姓名—设置安全设置为加密类型,并复制出来加密值2.4创建完成保持webhoo
    02-09
  • 03_Linux基础-文件类型-主辅提示符-第1提示符-Linux命令-内外部命令-快捷键-改为英文编码-3个时间-stat-其他基础命令
    03_Linux基础-文件类型-主辅提示符-第1提示符-L
    03_Linux基础-文件类型-主辅提示符-第1提示符-Linux命令-内外部命令-快捷键-改为英文编码-3个时间-stat-{1..100}-du-cd-cp-file-mv-echo-id-shell-ln-env-set-which-rpm-/usr-/与/root-hostname-vim-cat-pwd-alias-unalias-ls-ASCII-wc-chmod博客
    02-09
点击排行