JFS2 文件 rm 恢复。
[url]http://bbs.loveunix.net/thread-94019-1-1.html[/url] 讨论了 jfs1 rm的恢复。以下是 jfs2的,我没有写文件名的恢复,主要是解释起来太复杂,英文的,顺便收点钱。 楼猪,这东西好H啊。希望是好东西 的确是太强了,学习了 斥巨资买了,好好看看。鸟语不好真吃亏啊 要看懂这个难点 太黑了,不买 :lol 下来做个试验看看如何 这么贵希望是好东西:) 5个金币就说贵,不厚道:lol 这个比较高。 一个字“黑”! 斥巨资买了,好好看看。鸟语不好真吃亏啊 买就一个字!!! 试验了一下,不错,鉴于JFS2没有32位 JFS那么多限制,又是大于4MB如何如何,又是大文件系统如何如何,因此方法对付任何大小文件的通用性应当是没问题的。 等攒够了钱来买 晕 又是5个币````:L :L :L 实验了一下,没成功啊,从fsck部分开始就不同了。
16:42:27 root@ST-FREE:[/]#fsck /testjfs2
The current volume is: /dev/fslv01
Primary superblock is valid.
*** Phase 1 - Initial inode scan
*** Phase 2 - Process remaining directories
*** Phase 3 - Process remaining files
*** Phase 4 - Check and repair inode allocation map
File system inode map is corrupt; FIX? y
Superblock marked dirty because repairs are about to be written.
*** Phase 5 - Check and repair block allocation map
Inodes not connected to the root directory
tree have been detected. Will reconnect.
File system is clean.
Superblock is marked dirty; FIX? y
All observed inconsistencies have been repaired.
16:42:53 root@ST-FREE:[/]#mount /testjfs2
16:43:02 root@ST-FREE:[/]#cd /testjfs2
16:43:11 root@ST-FREE:[/testjfs2]#ls -lt
total 8
-rw-r--r-- 1 root system 4 Jan 06 16:35 test2
drwxr-xr-x 2 root system 256 Jan 06 16:32 lost+found
16:43:14 root@ST-FREE:[/testjfs2]#cd lost+found
16:44:08 root@ST-FREE:[/testjfs2/lost+found]#l
ksh: l: not found.
16:44:09 root@ST-FREE:[/testjfs2/lost+found]#ls
4
16:44:10 root@ST-FREE:[/testjfs2/lost+found]#cat 4
16:44:20 root@ST-FREE:[/testjfs2/lost+found]#ls -l
total 0
-rw-r--r-- 1 root system 0 Jan 06 16:34 4
16:44:26 root@ST-FREE:[/testjfs2/lost+found]# [quote]原帖由 [i]abit2007[/i] 于 2009-1-6 15:27 发表 [url=http://bbs.loveunix.net/redirect.php?goto=findpost&pid=873392&ptid=94093][img]http://bbs.loveunix.net/images/common/back.gif[/img][/url]
斥巨资买了,好好看看。鸟语不好真吃亏啊 [/quote]
你怎么学我说话啊:angry [quote]原帖由 [i]beginner-bj[/i] 于 2009-1-6 16:50 发表 [url=http://www.loveunix.net/redirect.php?goto=findpost&pid=873480&ptid=94093][img]http://www.loveunix.net/images/common/back.gif[/img][/url]
实验了一下,没成功啊,从fsck部分开始就不同了。
... [/quote]
不会吧,我屡试屡成啊:
编辑一下,避免盗版结果了LZ的挣钱生意:lol
[code]
[43p150:root:/test2] l /setup/*07
total 3000296
......
-rw-r--r-- 1 root sys 98089984 Nov 27 2008 X11.fnt.ucs.ttf.5.3.0.5
0.U
-rw-r--r-- 1 root sys 114598912 Nov 27 2008 X11.fnt.ucs.ttf_CN.5.3.
0.50.U
-rw-r--r-- 1 root sys 15360 Nov 27 2008 X11.fnt.ucs.ttf_extb.5.
3.0.10.U
-rw-r--r-- 1 root sys 7168 Nov 27 2008 X11.loc.en_US.Dt.rte.5.
3.0.60.U
-rw-r--r-- 1 root sys 7094272 Nov 27 2008 X11.motif.lib.5.3.0.60.
U
-rw-r--r-- 1 root sys 193536 Nov 27 2008 X11.motif.mwm.5.3.7.0.U
-rw-r--r-- 1 root sys 318464 Nov 27 2008 X11.samples.apps.aixcli
ents.5.3.0.60.U
[43p150:root:/test2] cp /setup/*07/X11.fnt.ucs.ttf_CN.5.3.0.50.U /setup/bbb
[43p150:root:/test2] cp /setup/bbb .
[43p150:root:/] rm test2/bbb
[43p150:root:/] sync
[43p150:root:/] umount /test2
[43p150:root:/] fsdb /test2
File System: /test2
File System Size: 519768 (512 byte blocks)
Aggregate Block Size: 4096
Allocation Group Size: 8192 (aggregate blocks)
> 重要操作
Inode 2 at block 33, offset 0x400:
[1] di_fileset: 16 [18] di_inostamp: 0x000ab676
[2] di_number: 2 [19] di_gen: 1
[3] di_size: 0x0000000000000100 [20] di_ixpxd.len: 4
[4] di_nblocks: 0x0000000000000000 [21] di_ixpxd.addr1: 0x00
[5] di_nlink: 3 [22] di_ixpxd.addr2: 0x00000021
[6] di_mode: 0x000141ed di_ixpxd.address: 33
0040755 drwxr-xr-x [24] di_uid: 0
[25] di_gid: 0
[9] di_atime.tj_nsec: 0x392e4160 [26] di_atime.tj_sec:0x00000000000abe6f
[10] di_ctime.tj_nsec: 0x1308e36b [27] di_ctime.tj_sec:0x00000000000ac18a
[11] di_mtime.tj_nsec: 0x1308e36b [28] di_mtime.tj_sec:0x00000000000ac18a
[12] di_otime.tj_nsec: 0x00000000 [29] di_otime.tj_sec:0x00000000000ab676
[13] di_ea.flag: 0x00 [30] di_ea.len: 0
EAv1 [31] di_ea.addr1: 0x00
[15] di_ea.nEntry: 0x00 [32] di_ea.addr2: 0x00000000
[16] di_ea.type: 0x0000 di_ea.address: 0
[34] di_ea.nblocks: 0
change_inode: [m]odify, [e]a, [t]ree, or e[x]it > 重要操作
Root D-Tree Node of inode 2
[1] flag 0x83 BT_ROOT BT_LEAF
[2] nextindex 2
[3] freecnt 6 Actual Free Count: 6
[4] freelist 2 type 'f' to walk
[5] idotdot 2
stbl {3,1,1,0,0,0,0,0} type '#' for specific stbl entry
Slots: next cnt type 's' to modify slot
slot[1]: 0 0
slot[2]: 4 1
slot[3]: 0 0
slot[4]: 5 1
slot[5]: 6 1
slot[6]: 7 1
slot[7]: 8 1
slot[8]: -1 1
dtree: Hit enter to see entries, [h]ex dump, [u]p, [m]odify, [f]reelist,
[s]lot, [#], or e[x]it: 重要操作
Slot: Inum Next NamLen Name
00000000: 00000000 00000002 00000000 00000000 |................|
00000010: 83020602 00000000 03010100 00000000 |................|
00000020: 00000000 00000003 FF0A6C6F 73742B66 |..........lost+f|
00000030: 6F756E64 00000000 00000000 00000000 |ound............|
00000040: 04010000 00000006 FF036262 62000000 |..........bbb...|
00000050: 00000000 00000000 00000000 00000000 |................|
00000060: 00000000 00000004 FF036161 61000000 |..........aaa...|
00000070: 00000000 00000000 00000000 00000000 |................|
00000080: 05010000 00000000 00000000 00000000 |................|
00000090: 00000000 00000000 00000000 00000000 |................|
000000a0: 06010000 00000000 00000000 00000000 |................|
000000b0: 00000000 00000000 00000000 00000000 |................|
000000c0: 07010000 00000000 00000000 00000000 |................|
000000d0: 00000000 00000000 00000000 00000000 |................|
000000e0: 08010000 00000000 00000000 00000000 |................|
000000f0: 00000000 00000000 00000000 00000000 |................|
-hit enter for more-
00000100: FF010000 00000000 00000000 00000000 |................|
00000110: 00000000 00000000 00000000 00000000 |................|
dtree: Press [u]p, [#], or e[x]it > 重要操作
> 重要操作
Inode 6 at block 33, offset 0xc00:
[1] di_fileset: 16 [18] di_inostamp: 0x000ab676
[2] di_number: 6 [19] di_gen: 3232612811
[3] di_size: 0x0000000006d4a400 [20] di_ixpxd.len: 4
[4] di_nblocks: 0x0000000000006d4b [21] di_ixpxd.addr1: 0x00
[5] di_nlink: 0 [22] di_ixpxd.addr2: 0x00000021
[6] di_mode: 0x000081a4 di_ixpxd.address: 33
0100644 -rw-r--r-- [24] di_uid: 0
[25] di_gid: 0
[9] di_atime.tj_nsec: 0x36cc62c0 [26] di_atime.tj_sec:0x00000000000ac108
[10] di_ctime.tj_nsec: 0x1308e36b [27] di_ctime.tj_sec:0x00000000000ac18a
[11] di_mtime.tj_nsec: 0x2ae097d5 [28] di_mtime.tj_sec:0x00000000000ac122
[12] di_otime.tj_nsec: 0x36cc62c0 [29] di_otime.tj_sec:0x00000000000ac108
[13] di_ea.flag: 0x00 [30] di_ea.len: 0
EAv1 [31] di_ea.addr1: 0x00
[15] di_ea.nEntry: 0x00 [32] di_ea.addr2: 0x00000000
[16] di_ea.type: 0x0000 di_ea.address: 0
[34] di_ea.nblocks: 0
change_inode: [m]odify, [e]a, [t]ree, or e[x]it > 最最最最最最重要操作
Inode 6 at block 33, offset 0xc00:
[1] di_fileset: 16 [18] di_inostamp: 0x000ab676
[2] di_number: 6 [19] di_gen: 3232612811
[3] di_size: 0x0000000006d4a400 [20] di_ixpxd.len: 4
[4] di_nblocks: 0x0000000000006d4b [21] di_ixpxd.addr1: 0x00
[5] di_nlink: 1 [22] di_ixpxd.addr2: 0x00000021
[6] di_mode: 0x000081a4 di_ixpxd.address: 33
0100644 -rw-r--r-- [24] di_uid: 0
[25] di_gid: 0
[9] di_atime.tj_nsec: 0x36cc62c0 [26] di_atime.tj_sec:0x00000000000ac108
[10] di_ctime.tj_nsec: 0x1308e36b [27] di_ctime.tj_sec:0x00000000000ac18a
[11] di_mtime.tj_nsec: 0x2ae097d5 [28] di_mtime.tj_sec:0x00000000000ac122
[12] di_otime.tj_nsec: 0x36cc62c0 [29] di_otime.tj_sec:0x00000000000ac108
[13] di_ea.flag: 0x00 [30] di_ea.len: 0
EAv1 [31] di_ea.addr1: 0x00
[15] di_ea.nEntry: 0x00 [32] di_ea.addr2: 0x00000000
[16] di_ea.type: 0x0000 di_ea.address: 0
[34] di_ea.nblocks: 0
change_inode: [m]odify, [e]a, [t]ree, or e[x]it > 重要操作
> 重要操作
[43p150:root:/] fsck -y /test2
The current volume is: /dev/test2lv
Primary superblock is valid.
J2_LOGREDO:log redo processing for /dev/test2lv
Primary superblock is valid.
*** Phase 1 - Initial inode scan
*** Phase 2 - Process remaining directories
*** Phase 3 - Process remaining files
*** Phase 4 - Check and repair inode allocation map
File system inode map is corrupt (FIXED)
Superblock marked dirty because repairs are about to be written.
*** Phase 5 - Check and repair block allocation map
Block allocation map is corrupt (FIXED)
Inodes not connected to the root directory
tree have been detected. Will reconnect.
File system is clean.
Superblock is marked dirty (FIXED)
All observed inconsistencies have been repaired.
[43p150:root:/] mount /test2
[43p150:root:/] cd test2
[43p150:root:/test2] l
total 100488
-rw-r--r-- 1 root system 51449856 Jan 09 11:44 aaa
drwxr-xr-x 2 root system 256 Jan 09 11:05 lost+found
[43p150:root:/test2] l l*
total 324320
-rw-r--r-- 1 root system 51449856 Jan 09 11:33 5
-rw-r--r-- 1 root system 114598912 Jan 09 11:46 6
[43p150:root:/test2] sum l*/6
sum /setp/bbb
30070 111913 lost+found/6
[43p150:root:/test2] sum /setup/bbb
30070 111913 /setup/bbb
[43p150:root:/test2]
[/code]
[[i] 本帖最后由 larryh 于 2009-1-6 18:17 编辑 [/i]] 又反复测试了几遍,发现rm前如果执行过sync,就能恢复,否则就是空文件。 咱们测试的机器都是没跑应用的,内存空闲得一塌糊涂,加上测试文件又小,sync间隔一般也是缺省的,除非运气好刚好在rm之前离上次sync 60秒,否则肯定那文件没真正写到硬盘,呵呵 没错,是和这个进程“/usr/sbin/syncd 60 ”有关。最多等1分钟以后再rm,也可以。 **** 作者被禁止或删除 内容自动屏蔽 **** 买了 虽然还不是很明白 但是迟早能明白!