linux inode小记

0. Sector & Block

硬盘最小单元:扇区(Sector)0.5K

文件最小单元:块(Block)4K(8个连续Sector)


1. 文件 = 数据块(Block)+索引(inode)

    1.1  数据块=文件数据内容

    1.2 索引=文件元信息 = file size + owner id + group id + rwx permissions + time stamp + link total + block Loc


2. Linux 打开文件步骤

    2.1 file name --> file inode num

    2.2 read inode info

    2.3 find file block Loc based on inode info


3. 查看文件inode号及inode内容

$ls -i test.txt

419875 test.txt

$stat test.txt

File: `test.txt'

Size: 4              Blocks: 8          IO Block: 4096  regular file

Device: 301h/769d      Inode: 419875      Links: 2

Access: (0644/-rw-r--r--)  Uid: (    0/    root)  Gid: (    0/    root)

Access: 2015-03-25 15:25:39.000000000 +0800

Modify: 2015-03-25 15:25:19.000000000 +0800

Change: 2015-03-25 15:26:49.000000000 +0800

结论:Linux系统文件数决定于inode数

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容