| 原因:误删了/data0/tcsql/cankao/phpcws-1.5.0/httpcws.cpp文件。由于忘了备份httpcws.cpp文件,重新开发工作量较大,因此只有恢复该文件一条路可走。 
   debugfs命令针对EXT2分区还行,但对EXT3分区就帮不上忙了。偶然发现的一款开源软件,解决了我的大忙。该软件下载网址为:http://code.google.com/p/ext3grep/   
   1、先安装ext3grep软件: wget http://ext3grep.googlecode.com/files/ext3grep-0.10.1.tar.gz tar zxvf ext3grep-0.10.1.tar.gz cd ext3grep-0.10.1 ./configure make make install 
   2、umount /data0分区: umount /data0   如果提示busy,先kill正在使用这个目录的进程,再umount: fuser -k /data0 umount /data0 
   3、查询所有Inode,(执行需要几分钟~十多分钟): ext3grep /dev/sdb1 --ls --inode 2 
   4、逐级查找Inode,看是否能找到httpcws.cpp文件(此步骤也可省略):  5、恢复/data0/tcsql/cankao/phpcws-1.5.0/httpcws.cpp文件: ext3grep /dev/sdb1 --restore-file tcsql/cankao/phpcws-1.5.0/httpcws.cpp 
   如果提示以下信息,则表示恢复成功:   Restoring tcsql/cankao/phpcws-1.5.0/httpcws.cpp   这时,执行ext3grep命令的当前目录下将会自动生成一个名为RESTORED_FILES的文件夹,文件夹下的tcsql/cankao/phpcws-1.5.0/httpcws.cpp即为恢复的文件。查看了一下,和被删除前的内容一样,大功告成。 
 
   6、重新mount /data0分区: mount /dev/sdb1 /data0 
 
 注意:执行第三步,可能汇报如下的错误:
 ext3grep: init_directories.cc:534: void init_directories(): Assertion `lost_plus_found_directory_iter != all_directories.end()' failed.
 
 原因:这个工具有一个bug,出错后不会向下执行ext3grep: init_directories.cc:534: void init_directories(): Assertion `lost_plus_found_directory_iter != all_directories.end()' failed.,从而造成恢复失败,作者放出了一个补丁,下载地址:链接: http://pan.baidu.com/s/1i5sfwfr 密码: t646
 
 解决办法:记住,把它放到解压好的ext3grep目录里面,重新编译安装ext3grep。
 
 
 再次执行第三步,如果还报如下的错误:
 ext3grep-0.2.0 - ext3grep.cc:4130: bool init_directories_action(): Assertion `first_block != -1' failed.
 
 原因及解决办法:如果报错记得删除 ext3grep执行目录 下的 sda2.ext3grep.stage* , 其中的sda2是我的分区。 这个问题还导致了其他错误,不过具体不记得出错点了,总之如果时间不是很紧张的话, 做下一个命令前 记得删sda2.ext3grep.stage*就好了
 
 
 
 还有一种如下:
 Assertion `device.good()' failed (in get_block.cc:37)
 
 解决方法: 选择一个足够大的分区来存储恢复的文件。
 |