设为首页 收藏本站
查看: 758|回复: 0

[经验分享] Linux 数据恢复:extundelete

[复制链接]

尚未签到

发表于 2019-2-17 08:20:35 | 显示全部楼层 |阅读模式
https://sourceforge.net/projects/extundelete/
[root@king01 ~]# yum install -y e2fsprogs e2fsprogs-devel
[root@king01 ~]# tar jxvf extundelete-0.2.4.tar.bz2
[root@king01 ~]# cd extundelete-0.2.4
[root@king01 extundelete-0.2.4]# ./configure
[root@king01 extundelete-0.2.4]# make
[root@king01 extundelete-0.2.4]# make install
[root@king01 ~]# extundelete --help
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.
[root@king01 ~]# cd /usr/local/src
[root@king01 src]# ls -l
total 31452
drwxr-xr-x 33 7161 31415     4096 Sep 10 18:23 mysql-5.6.42
-rw-r--r--  1 root root  32201731 Jan 11 16:37 mysql-5.6.42.tar.gz
[root@king01 src]# rm -rf *
[root@king01 ~]# umount /usr/local/src
[root@king01 ~]# extundelete /dev/sdb1 --inode 2
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 640 groups loaded.
Group: 0
Contents of inode 2:
0000 | ed 41 00 00 00 10 00 00 f6 55 38 5c 3f 56 38 5c | .A.......U8\?V8\
0010 | 3f 56 38 5c 00 00 00 00 00 00 02 00 08 00 00 00 | ?V8\............
0020 | 00 00 00 00 0f 00 00 00 21 24 00 00 00 00 00 00 | ........!$......
0030 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0080 | 1c 00 00 00 00 c2 2c 34 00 c2 2c 34 94 0d be 0e | ......,4..,4....
0090 | 70 48 38 5c 00 00 00 00 00 00 00 00 00 00 00 00 | pH8\............
00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00b0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00d0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00f0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
Inode is Allocated
File mode: 16877
Low 16 bits of Owner Uid: 0
Size in bytes: 4096
Access time: 1547195894
Creation time: 1547195967
Modification time: 1547195967
Deletion Time: 0
Low 16 bits of Group Id: 0
Links count: 2
Blocks count: 8
File flags: 0
File version (for NFS): 0
File ACL: 0
Directory ACL: 0
Fragment address: 0
Direct blocks: 9249, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Indirect block: 0
Double indirect block: 0
Triple indirect block: 0
File name                                       | Inode number | Deleted status
.                                                 2
..                                                2
mysql-5.6.42.tar.gz                               11             Deleted
mysql-5.6.42                                      1835009        Deleted
[root@king01 ~]# extundelete /dev/sdb1  --restore-file mysql-5.6.42.tar.gz
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 640 groups loaded.
Loading journal descriptors ... 3717 descriptors loaded.
Successfully restored file mysql-5.6.42.tar.gz
[root@king01 ~]# extundelete /dev/sdb1 --restore-directory mysql-5.6.42
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 640 groups loaded.
Loading journal descriptors ... 3717 descriptors loaded.
Searching for recoverable inodes in directory mysql-5.6.42 ...
15308 recoverable inodes found.
Looking through the directory structure for deleted files ...
2 recoverable inodes still lost.
[root@king01 ~]# cd RECOVERED_FILES
[root@king01 RECOVERED_FILES]# ls -l
total 31452
drwxr-xr-x 33 root root     4096 Jan 11 16:41 mysql-5.6.42
-rw-r--r--  1 root root 32201731 Jan 11 16:41 mysql-5.6.42.tar.gz



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-673391-1-1.html 上篇帖子: Linux 操作命令 wc 下篇帖子: Linux 操作命令 grep
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表