介绍两款Linux文件恢复工具,ext3grep与extundelete,可能在关键时刻会有所帮助。ext3grep仅对ext3文件系统有效,extundelete对ext3与ext4文件系统都有效
- cd /home
- dd if=/dev/zero of=sdc1 bs=1M count=100 #块大小为1M,数量为100,也就是100M
- mkfs.ext3 /home/sdc1 #ext3文件系统格式化
- mount /home/sdc1 /sdc
本实例采用第一种方式添加2块磁盘,添加后一块ext3格式化,另一块ext4格式化,然后挂载。具体操作过程省略
- mount 查看下
- /dev/sdb1 on /sdb type ext4 (rw)
- /dev/sdc1 on /sdc type ext3 (rw)
- root@ubuntu-test:/home# cat /etc/apt/sources.list
- deb http://ubuntu.cn99.com/ubuntu/ quantal main restricted universe multiverse
- deb http://ubuntu.cn99.com/ubuntu/ quantal-updates main restricted universe multiverse
- deb http://ubuntu.cn99.com/ubuntu/ quantal-security main restricted universe multiverse
- deb http://ubuntu.cn99.com/ubuntu/ quantal-backports main restricted universe multiverse
- deb http://ubuntu.cn99.com/ubuntu-cn/ quantal main restricted universe multiverse
- aptitude install ext3grep
- ext3grep --ls --inode 2 /dev/sdc1
- ext3grep --ls --inode 8193 /dev/sdc1
- ext3grep --ls --dump-names /dev/sdc1 > filename.txt #将显示结果放在一个文件中
- ext3grep --restore-file VMwareTools-9.2.2-893683.tar.gz /dev/sdc1
- ext3grep --restore-file vmware-tools-distrib/INSTALL.log /dev/sdc1
- ext3grep --restore-all /dev/sdc1
- ext3grep --restore-all --after 1365661200 /dev/sdc1 #恢复Apr 11 14:20 2013之后被删文件
- ext3grep --restore-all --before 1365661200 /dev/sdc1 #恢复Apr 11 14:20 2013之前被删文件
- wget http://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2
- sudo apt-get install e2fsprogs
- sudo apt-get install e2fslibs-dev
- sudo apt-get install build-essential
- tar -jxvf extundelete-0.2.4.tar.bz2
- cd extundelete-0.2.4
- ./configure --prefix=/usr/local/extundelete
- make && make install
- cd /usr/local/extundelete/bin
- ./extundelete -v
- ./extundelete --restore-file aaa /dev/sdb1
- ./extundelete --restore-all /dev/sdb1
- date -d "Apr 11 14:30 2013" +%s
- 1365661800
- ./extundelete --restore-all --after “1365661800” /dev/sdb1