ext3grep能够恢复通过rm -rf删除的文件
模拟实验恢复
1 分区状况
2 误删操作
3 恢复
/root/RESTORED_FILES
[root@node2 RESTORED_FILES]# ls
?? ib_logfile1 mysqlbin.000001 mysql-bin.000003 mysqlbin.000004 mysqlbin.000006 mysql-bin.index mysqld-relay-bin.index zabbix
ibdata1 lost+found mysql-bin.000002 mysqlbin.000003 mysql-bin.000005 mysqlbin.000007 mysqlbin.index node2.err
ib_logfile0 mysql-bin.000001 mysqlbin.000002 mysql-bin.000004 mysqlbin.000005 mysqlbin.000008 mysqld-relay-bin.000001 node2-slow.log
*恢复单个文件
模拟实验恢复
1 分区状况
- [root@node2 RESTORED_FILES]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/mapper/VolGroup00-LogVol00
- 5.7G 4.3G 1.2G 80% /
- /dev/sda1 99M 12M 82M 13% /boot
- tmpfs 147M 0 147M 0% /dev/shm
- /dev/sdb1 5.0G 139M 4.6G 3% /ext3dir ---目标
2 误删操作
- [root@node2 ext3dir]# ls
- ib_logfile1 mysqlbin.000001 mysql-bin.000003 mysqlbin.000004 mysqlbin.000006 mysql-bin.index mysqld-relay-bin.index zabbix
- ibdata1 lost+found mysql-bin.000002 mysqlbin.000003 mysql-bin.000005 mysqlbin.000007 mysqlbin.index node2.err
- ib_logfile0 mysql-bin.000001 mysqlbin.000002 mysql-bin.000004 mysqlbin.000005 mysqlbin.000008 mysqld-relay-bin.000001 node2-slow.log
- [root@node2 ext3dir]# rm -rf /ext3dir/*
3 恢复
- 赶快对盘umount,防止重新写入补删文件扇区。下载ext3grep,安装(编译安装过程艰辛暂且不表)。
- *先执行扫描文件名命令:
-
- [root@node2 ~]# ext3grep /dev/sdb1 --dump-names
- Running ext3grep version 0.10.1
- Number of groups: 40
- Minimum / maximum journal block: 841 / 34478
- Loading journal descriptors... sorting... done
- The oldest inode block that is still in the journal, appears to be from 1472610198 = Wed Aug 31 10:23:18 2016
- Number of descriptors in journal: 82; min / max sequence numbers: 2 / 12
- 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 directory start that we found previously.
-
- Searching group 0: DD++D++
- 。。
- abbix/trigger_discovery.frm
zabbix/triggers.frm
zabbix/user_history.frm
zabbix/users.frm
zabbix/users_groups.frm
zabbix/usrgrp.frm
zabbix/valuemaps.frm
- [root@node2 ~]# ext3grep /dev/sdb1 --dump-names
- *执行文件恢复命令
-
- 这款软件不能按目录恢复文件,只能执行恢复全部命令:
- [root@node2 ~]# ext3grep /dev/sdb1 --restore-all
- 。。。
- 。。。
- 注意:(在哪个目录下执行ext3grep 命令,恢复的数据文件就在哪个目录的RESTORED_FILES目录下)
*检查
- 这款软件不能按目录恢复文件,只能执行恢复全部命令:
- 已全部恢复
/root/RESTORED_FILES
[root@node2 RESTORED_FILES]# ls
?? ib_logfile1 mysqlbin.000001 mysql-bin.000003 mysqlbin.000004 mysqlbin.000006 mysql-bin.index mysqld-relay-bin.index zabbix
ibdata1 lost+found mysql-bin.000002 mysqlbin.000003 mysql-bin.000005 mysqlbin.000007 mysqlbin.index node2.err
ib_logfile0 mysql-bin.000001 mysqlbin.000002 mysql-bin.000004 mysqlbin.000005 mysqlbin.000008 mysqld-relay-bin.000001 node2-slow.log
*恢复单个文件
[root@node2 ~]# ext3grep /dev/sdb1 --restore-file mysqlbin.000004 Running ext3grep version 0.10.1
WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set. This either means that your partition is still mounted, and/or the file system is in an unclean state.
Number of groups: 40
Minimum / maximum journal block: 841 / 34478
Loading journal descriptors... sorting... done
The oldest inode block that is still in the journal, appears to be from 1472610198 = Wed Aug 31 10:23:18 2016
Number of descriptors in journal: 82; min / max sequence numbers: 2 / 15
Loading sdb1.ext3grep.stage2... done
Restoring mysqlbin.000004
[root@node2 ~]# ls RESTORED_FILES/
mysqlbin.000004
WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set. This either means that your partition is still mounted, and/or the file system is in an unclean state.
Number of groups: 40
Minimum / maximum journal block: 841 / 34478
Loading journal descriptors... sorting... done
The oldest inode block that is still in the journal, appears to be from 1472610198 = Wed Aug 31 10:23:18 2016
Number of descriptors in journal: 82; min / max sequence numbers: 2 / 15
Loading sdb1.ext3grep.stage2... done
Restoring mysqlbin.000004
[root@node2 ~]# ls RESTORED_FILES/
mysqlbin.000004
后续:ext4文件系统是否支持还没测试,待续!
参考文档:
http://dbaplus.cn/news-21-641-1.html
http://blog.sina.com.cn/s/blog_96c3ca3a01014qe6.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29096438/viewspace-2124248/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29096438/viewspace-2124248/