问题:如何在 ext4 分区下恢复删除的文件

相信浏览这里的朋友们都有或多或少的数据恢复的经验,不过如何在新近的 ext4 文件系统上恢复已经删除的文件呢?

事情起因(仅为BS XX 的 M$ Office 而存在,可以略过)昨日在下的女友不慎在 OpenOffice.org 中将刚刚写好的中文 doc 文件保存成 Word 95 格式,由于 XX 的 Word 95 不支持 Unicode 字符,该文档再次打开的时候全部变成问号了……于是全部希望就被寄托在先前导出的 PDF 文件。但是该 PDF 文件已经被 Shift + Del 了……怎么办?如何恢复?

这种情况肯定每个人都遇到过,尽管无论在终端还是GUI下都会提醒,但总是在习惯性的输入或点击 Yes 后才反应过来……

Google 了许久,恢复误删除文件的方案集中在以下几个:

undelete 仅适合 ext2 和 ext3;

giis 不能恢复安装 giis 之前删除的文件;

ext3grep 仅限 ext3;

R-Linux 唯一标注支持 ext4 的,但是需要有 Win32 系统才能运行……

难道在 Linux 系统上就没有一个适合 ext4 文件系统恢复误删除文件的解决方案么? 肯定存在,只是没找到……

故再次请教诸位常逛 LinuxTOY 的朋友们,希望能指点一个可行的方案。

在下先谢过啦~

Read More:

27 Comments

  1. 1 hmy Commented @ 2009-12-14 9:09Reply to this comment

    经常误删除文件的人可以尝试下 nilfs2这个文件系统 ,类似于一个文件系统级的版本管理系统.

  2. 2 dedelok Commented @ 2009-12-14 9:12Reply to this comment

    R-linux 这个软件可以在PE环境下运行!

  3. 3 Annoymous Commented @ 2009-12-14 9:28Reply to this comment

    可以试一下 extundelete

  4. 4 冰怨 Commented @ 2009-12-14 9:29Reply to this comment

    可以试试Foremost和testdisk

  5. 5 Iven Commented @ 2009-12-14 10:48Reply to this comment

    对于用 reiserfs 和其他文件系统的该怎么办呢……貌似只有 ext 的解决方法比较多……

  6. 6 Ryan_fu Commented @ 2009-12-14 10:52Reply to this comment

    推荐一下testdisk

  7. 7 Toy Commented @ 2009-12-14 10:55Reply to this comment

    黑兄或许还可以试试 PhotoRec

  8. 8 francis Commented @ 2009-12-14 11:11Reply to this comment

    testdisk,强大好用

  9. 9 ProgramFan Commented @ 2009-12-14 11:47Reply to this comment

    可以看看这篇文章 http://www.ibm.com/developerworks/cn/linux/l-cn-filesrc5/index.html 一定要先备份你的硬盘分区。 目前似乎没有直接的软件可以用来恢复 ext3/4 上面被删除的文件。

  10. 10 ubuntu lover Commented @ 2009-12-14 11:53Reply to this comment

    This new TestDisk version ( 6.11+) can undelete files for NTFS filesystem and recover deleted exFAT and ext4.

  11. 11 ubuntu lover Commented @ 2009-12-14 11:56Reply to this comment

    extract the tar.bz2 file and started Photorec with the following command.

    @:/$ sudo /home/***/testdisk-6.11/linux/photorec_static

  12. 12 Terry Commented @ 2009-12-14 12:02Reply to this comment

    看到过别人用testdisk恢复U盘中的照片成功的案例,不过那是FAT32文件系统。看Release notes最新版的testdisk支持ext4,祝你好运了!

    This new TestDisk version can undelete files for NTFS filesystem and recover deleted exFAT and ext4. http://www.cgsecurity.org/wiki/TestDisk_6.11_Release

    恢复毕竟是没办法的办法了,还是得养成好的备份的习惯才行。这时候如果是用Dropbox的话就好办了...

  13. 13 Yeqin_Su Commented @ 2009-12-14 12:08Reply to this comment

    在下是来学习的……

  14. 14 jiazhoulvke Commented @ 2009-12-14 12:38Reply to this comment

    不会,深表同情的路过……

  15. 15 hmy Commented @ 2009-12-14 13:33Reply to this comment

    重要资料备份是个好习惯. ps:我用windows,做的第一个事情就是把回收站禁用

  16. 16 zakarum Commented @ 2009-12-14 13:51Reply to this comment

    testdisk所带的photorec程序可以找回ext4中已经删除的文件,但是正确找回的前提是,这些文件是连续的,假如存在不连续的部分,那么找来的往往是无用或者错乱的东西。比如一个4G大小的RPM,或者一个只有500K的ISO。。。。

    除了R-linux还有一个印度产软件也在最近添加了ext4的数据恢复功能,不过也是商业软件,并且只能在windows下使用,我下载了预览版看了下,可笑的是这个东西在windows下UI部分也是错乱的,不过确实能有效的找回被删文件。

    其实根据IBM dW上文章,ext4的数据恢复和ext3比差别并不大,不过不知道为什么debugfs,tune2fs之类的实用程序迟迟不能跟上,或许社区并不指望ext4服役很长时间?

  17. 17 luojie-dune Commented @ 2009-12-14 14:02Reply to this comment

    google告诉我,找 ext4 file recover 的话会返回

    extundelete: An ext3 and ext4 file undeletion utility extundelete is a utility that can recover deleted files from an ext3 or ext4 partition. The ext3 file system is the most common file system when using Linux ... extundelete.sourceforge.net/
    http://extundelete.sourceforge.net/

  18. 18 likuku Commented @ 2009-12-14 14:57Reply to this comment

    节哀顺变。 很难,备份是王道,桌面的话,DropBox也是个选择,ZFS的时间机器更好。

  19. 19 shellexy Commented @ 2009-12-14 15:29Reply to this comment

    @hmy: 恩

    zfs 这些需要手工建立快照,

    所以白月兄还是用 nilfs2 这样相当于有连续快照的文件系统好, 只不过 nilfs2 现在性能还不是太好

    nilfs2 连续快照的简要介绍可以看看 http://www.ibm.com/developerworks/cn/linux/l-nilfs-exofs/index.html

    就算没有手工建立快照,在垃圾回收前所有检查点都是可用的临时快照

  20. 20 黑日白月 Commented @ 2009-12-14 19:17Reply to this comment

    感谢诸位朋友的好方法,思路一下子打开了,谢谢啦~

    PhtotRec 这种通过数据类型恢复的软件似乎是个合适的方案,TestDisk 等全盘扫描的有点杀鸡用牛刀的说。

    让女友试试~

  21. 21 9shell Commented @ 2009-12-14 21:07Reply to this comment

    希望恢复了给个教程,我喜欢存在网盘上。

  22. 22 kidfruit Commented @ 2009-12-14 22:33Reply to this comment

    我记得OOo本身应该有历史记录,哪怕已经删除了的原始文件,OOo也会有副本备份才对……

  23. 23 黑日白月 Commented @ 2009-12-15 6:24Reply to this comment

    测试成功,PhotoRec 成功恢复了移动硬盘 ext4 分区上的 Shift + Del 删除的 doc 文档!

    尽管文件名和扩展名(变成 ppt 了)都不对了,但是只要修改成合适的扩展名即可, md5sum 校验值返回一致。

    testdisk 和 photorec 也被包含在 fedora 12 软件仓库里,安装很方便。

  24. 24 lszh Commented @ 2009-12-16 13:12Reply to this comment

    在此恭喜

  25. 25 lilydjwg Commented @ 2009-12-16 15:52Reply to this comment

    严重警告:

    将Ooo保存为M$ Office格式要事先备份!本人同学因此丢过一份文件,本人亦如是。

  26. 26 oldherl Commented @ 2009-12-16 16:30Reply to this comment

    “md5sum 校验值返回一致”? 怎么会有之前的md5值呢?

  27. 27 cylinc Commented @ 2009-12-18 20:43Reply to this comment

    同上问,另外在Linux,我都是用永中OFFICE,尽管也会有崩溃发生,但比OOO还是要稳定的多。