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数