分类:
2009-01-07 12:18:29
首先,要感谢LOVEUNIX 技术专家projects 提供的用fsdb恢复JFS2文件系统已删文件的使用范例——
据此,写了脚本可以列出某JFS2文件系统可能可以恢复的文件、目录列表:
FindRemovedFile () {
FS=$1
fsck $FS >/dev/null
echo "i 2 \n t \n h \n \n x \n q \n" | fsdb $FS |\
awk -F\| '/^0/ {if($2~/^\.{2}/ && $2!~/\.{16}/) {split($1,a," ");printf $0;printf " i-node: %d\n","0x"a[3]} else {print}}'
}
FindRemovedFile /ftp #此处以文件系统名/ftp为例
这是实际运行结果:
11:20:32 () {
> FS=$1
> fsck $FS >/dev/null
> echo "i 2 \n t \n h \n \n x \n q \n" | fsdb $FS |\
> awk -F\| '/^0/ {if($2~/^\.{2}/ && $2!~/\.{16}/) {split($1,a," ");printf $0;printf " i-node: %d\n","0x"a[3]} else {print}}'
> }
11:20:34 /ftp
00000000: 00000000 00000002 00000000 00000000 |................|
00000010: 85010702 00000000 01040208 03060701 |................|
00000020: 00000100 000F0B3D FF006C6F 73742B66 |.......=..lost+f| i-node: 985917
00000030: 6F756E64 00000000 00000000 00000000 |ound............|
00000040: 03000000 00000020 FF044650 31340000 |....... ..FP14..| i-node: 32
00000050: 00000000 00000000 00000000 00000000 |................|
00000060: 04000000 000031E0 FF036462 32000000 |......1...db2...| i-node: 12768
00000070: 00000000 00000000 00000000 00000000 |................|
00000080: 05000000 00000004 FF114149 58354C54 |..........AIX5LT| i-node: 4
00000090: 4C30375F 5350322E 74617200 00000000 |L07_SP2.tar.....|
000000a0: 06000000 00008000 FF0D4149 58354C54 |..........AIX5LT| i-node: 32768
000000b0: 4C30375F 53503200 00000000 00000000 |L07_SP2.........|
000000c0: 07000000 00000005 FF166968 732E3630 |..........ihs.60| i-node: 5
000000d0: 32302E61 69782E70 70633332 2E746172 |20.aix.ppc32.tar|
000000e0: 08000000 00000006 FF0A6968 735F7570 |..........ihs_up| i-node: 6
000000f0: 2E746172 00000000 00000000 00000000 |.tar............|
11:20:37 ]#
说明:这是针对JFS2文件系统的,JFS文件系统我没研究过,因为我想不出目前仍然使用JFS的任何理由。
========================================================================
任何形式的转载,请写明出处:
email:
blog: http://www.cublog.cn/u/739/
========================================================================
网页上看,格式乱了,所以上传了文本附件:
|