[文章作者:张宴 本文版本:v1.0 最后修改:2009.07.06 转载请注明原文链接:http://blog.zyan.cc/linux_ext3_undelete/]

  环境:CentOS 5.3 x86_64下,/dev/sdb1为数据分区/data0,EXT3文件系统。
  前因:误删了/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


  参考资料:http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html




技术大类 » 其他Unix技术 | 评论(53) | 引用(0) | 阅读(84177)
1314it Email Homepage
2009-7-30 10:52
张宴大哥  关于这个图片用什么软件做的  期待你的回复啊  ..


这是图片的源地址 (baidu相册上面) : http://hiphotos.baidu.com/shengit/pic/item/ed9bc7fa0381b90a4e4aea46.jpeg
Toad
2009-7-31 08:38
不错!刚才DD出一个文件格成EXT3测试了一下,可以成功恢复!不过不知道能不能批量恢复呢?比如我不小心在数据库的根上面RM -RF了。如果像你说的这样恢复效率有点慢哈!不过能恢复就算不错了!
red
2009-8-3 21:28
张哥。一定要帮我解决呀。
在恢复文件的时候就报这个错。然后就中止了

ext3grep: init_directories.cc:534: void init_directories(): Assertion `lost_plus_found_directory_iter != all_directories.end()' failed.已放弃

是什么原因呢?要是不能恢复。我就要完了!
rhlei Homepage
2009-8-8 21:34
不知道你试过大文件没有?生产上可以用吗?
cnbird
2009-8-13 10:47
ext3grep: init_directories.cc:534: void init_directories(): Assertion `lost_plus_found_directory_iter != all_directories.end()' failed.已放弃
我也出现这个问题了
xixi
2009-8-16 21:32
博主,我是来向您报告一个无耻网站的,不是广告。
http://www.anqn.com/os/linux/2009-08-14/a09114721.shtml

anqn 是一个十分无耻的网站!!
miladuo
2009-8-17 16:54
好文章,的确测试成功。不过好像“/”目录下的文件不一定行。
Yousri Email Homepage
2010-10-28 17:02
同样有几个疑问:1、要是恢复目录的话一定需要将文件夹里的文件一个个恢复么 或能直接回复整个目录?2、如果是只有或是删除的是根目录 / 下的文件或目录能否恢复?3、对于使用LVM的搜索相对比较慢是否有其他措施哦
Yousri Email
2010-10-28 17:11
答一:原来可以直接使用命令:ext3grep /home/store/file --restore-all 恢复整个目录 至于第二、三问题有待考证 也希望有知道者能指点下
zhdata Email Homepage
2010-12-25 13:59
路过看看,这篇文章不错
louis vuitton uk Email Homepage
2011-11-22 17:10
This louis vuitton uk for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine christian louboutin sale. Purse the elegance in bridal wedding. Enjoy the fashion.
armani watches Email Homepage
2011-11-23 10:12
If you are looking for armani Bags, our armani watches Handbags Canada outlet store is your first choice. We promise Original Packing and Best Discount,3-5 Workdays To Your Door!If you buy bags and purses of the latest new designs from the louis vuitton outlet now, you can enjoy special discounts. What else are you waiting for?After you choose the right kind of plants and the size pot for the plant.
Louis Vuitton Neverfull Email Homepage
2012-4-21 17:56
www.lvbagsclassic.com are authorized authentic Louis Vuitton handbags outlet store. All the items at our site are 100% authentic. All our Louis Vuitton handbags will come with the authenticity card, serial Number, dust bag and care booklet. We promise you will be 100% satisfied when you get such cheap authentic Louis Vuitton handbags from us!
Louis Vuitton Neverfull
Hogan
2012-5-10 18:02
In che possono posso individuare un fabbro uno dei più affidabili Greater London? Nel caso in cui si vogliono ottenere le aziende particolari del vostro fabbro Grande Londra quindi si sta andando in vista di un individuo Hogan che è totalmente certificata che è successo con fiducia. Nel caso in cui si va a vedere Locallocksmith24hour. corp. britannico sarete in grado di ottenere probabilmente il più efficace fabbro Grande Londra sta offrendo.
hogan280 Email
2012-5-10 18:10
Nove mesi dopo, nell'agosto 2009, il Crown Prosecution Service ha deciso di non caricare i due uomini, come la Hogan ragazza avrebbe fatto un "testimone inattendibile" e l'avvocato dubitava alcuna giuria avrebbe creduto.
lirourou77 Email Homepage
2012-9-5 14:11
Lvjing Hai, the flexibility to delay the basic pension policy, if implemented, will do the elderly occupied by young people to work. In this regard, countries <b>discount designer clothes<b>      
should be to stimulate economic growth, new jobs, to alleviate this problem.

His analysis, private enterprises and foreign enterprises, joint ventures, to attract a large number of employment staff in order to enable flexibility to delay in receiving the basic pension policies can be implemented smoothly, it seems, or should the broad-brush approach to enforce appropriate.

Chu Fu-ling: each year involving tens of millions <b>wholesale designer handbags<b>      
of people

Chu Fu Ling told reporters in the country to implement the flexibility to delay the basic pension policies each year may involve tens of millions of people, and thus lead to the problem of young people unable to enter these positions. This massive amount of posts can not be vacated, may be <b>designer handbags for less<b>      
difficult through the newly developed position, such as to resolve all of a sudden.
宝仔
2012-9-27 13:12
mcsrainbow
2012-12-30 14:24
该软件只能应用于一般的小文件恢复,单个文件不能超过200M左右(具体大小没时间详细去测试),只能用于个人系统,比较另人失望!
分页: 2/3 第一页 上页 1 2 3 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]