ext2目录文件的内容验证

本文通过debugfs命令解析了Linux文件系统中软链接的存储细节,并使用dd命令读取了特定块的内容,展示了如何从目录项中识别软链接文件及其相关信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[root@law dir]# ls -il
total 16
114323 drwxr-xr-x 2 root root 4096 Sep 10 22:16 dir1
114325 lrwxrwxrwx 1 root root 6 Sep 10 22:33 oracle.ln -> /orale
114324 -rw-r--r-- 1 root root 0 Sep 10 22:16 test.txt

[root@law dir]# debugfs /dev/sda1
debugfs 1.35 (28-Feb-2004)
debugfs: stat /dir
Inode: 114135 Type: directory Mode: 0755 Flags: 0x0 Generation: 3268397653
User: 0 Group: 0 Size: 4096
File ACL: 142889 Directory ACL: 0
Links: 3 Blockcount: 16
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x48c7dccd -- Wed Sep 10 22:42:21 2008
atime: 0x48c7dcd2 -- Wed Sep 10 22:42:26 2008
mtime: 0x48c7dccd -- Wed Sep 10 22:42:21 2008
BLOCKS:
(0):258049
TOTAL: 1

[root@law dir]# dd if=/dev/sda1 of=/root/dir.dd bs=4096 count=1 skip=258049
1+0 records in
1+0 records out
[root@law dir]# cd /root
[root@law ~]# od -h dir.dd
0000000 bdd7 0001 000c 0201 002e 0000 0002 0000
0000020 000c 0202 2e2e 0000 be93 0001 000c 0204
0000040 6964 3172 be94 0001 0010 0108 6574 7473
0000060 742e 7478 be95 0001 0fcc 0709 726f 6361
0000100 656c 6c2e 006e 0000 be96 0001 0fb8 0106
0000120 6964 2e72 6464 0000 0000 0000 0000 0000
0000140 0000 0000 0000 0000 0000 0000 0000 0000
*
0010000

黑体部分是oracle.ln这个软链接文件在此目录文件中存储的信息。

其中:be95 0001 转换为 0001be95,即inode号码1143250709中的07表示此文件的类型为软链接,09表示此文件的文件名长度。726f 6361 656c 6c2e 006e是此文件的名称:oracle.ln ,0000为补齐位数之用。

0fcc本该是此文件所占目录项的长度,但不能合理解释。

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/37724/viewspace-1010521/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/37724/viewspace-1010521/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值