0. Sector & Block
硬盤最小單元:扇區(qū)(Sector)0.5K
文件最小單元:塊(Block)4K(8個(gè)連續(xù)Sector)
1. 文件 = 數(shù)據(jù)塊(Block)+索引(inode)
? ? 1.1 ?數(shù)據(jù)塊=文件數(shù)據(jù)內(nèi)容
? ? 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號(hào)及inode內(nèi)容
$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
結(jié)論:Linux系統(tǒng)文件數(shù)決定于inode數(shù)