|
|
我今天误删了一些文件,觉得很可惜,就萌生要恢复他们的想法。经过资料的查询,以及自己的摸索,终于找到成功恢复被删文件的方法。原来如此简单。
1:赶紧umount你删文件所在的设备。千万不要在写任何东西进去,以免覆盖。
2:以我的情况为例,因我的文件是在/dev/hda7被删的。所以debugfs /dev/hda7
3:输入指令:lsdel查看被删的文件inode。
debugfs: lsdel
Inode Owner Mode Size Blocks Time deleted
12 0 100644 17076307 4176/4176 Mon Aug 16 23:43:34 2004
13 0 100644 8740 3/ 3 Mon Aug 16 23:43:34 2004
14 0 100644 85471819 20890/20890 Mon Aug 16 23:43:34 2004
15 0 100644 180271 46/ 46 Mon Aug 16 23:43:34 2004
4:显示你需要恢复文件的inode的信息。
debugfs: stat <12>
Inode: 12 Type: regular Mode: 0644 Flags: 0x0 Generation: 9997
User: 0 Group: 0 Size: 17076307
File ACL: 0 Directory ACL: 0
Links: 0 Blockcount: 33408
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x4120d626 -- Mon Aug 16 23:43:34 2004
atime: 0x4120d580 -- Mon Aug 16 23:40:48 2004
mtime: 0x4120d4ca -- Mon Aug 16 23:37:46 2004
dtime: 0x4120d626 -- Mon Aug 16 23:43:34 2004
BLOCKS:
(0-11):520-531, (IND):532, (12-1035):533-1556, (DIND):1557, (IND):1558, (1036-2059):1559-2582, (
IND):2583, (2060-3083):2584-3607, (IND):3608, (3084-4107):3609-4632, (IND):4633, (4108-4169):463
4-4695
TOTAL: 4176
5:dump inode所有块(block)的内容到文件中。
debugfs: dump <12> /tmp/recover
6:quit
完了。/tmp/recover就是你要恢复的文件了。赶紧cd /tmp
root@lfs:tmp# file recover。
recover: bzip2 compressed data, block size = 900k
成功了。tar xvfj recover试试看。呵呵!
这种方法屡试屡爽。真的很好用。大家可以试试。 |
|