空文件Size=6,文件达到一定数量Size变为4096,更多文件按照4096步进
[root@localhost tmp]# mkdir 123
[root@localhost tmp]# stat 123 | grep Size
Size: 6 Blocks: 0 IO Block: 4096 directory
新建1000个文件后,Size变为4096*18
# cat new1000file.py
import os
for i in range(1000):
os.system('touch 123/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%05d'%i)
# python new1000file.py
# stat 123 | grep Size
Size: 73728 Blocks: 192 IO Block: 4096 directory
# python -c "print 73728/4096"
18
新建2000个文件后,Size变为4096*54
# cat new2000file.py
import os
for i in range(2000):
os.system('touch 123/yxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%05d'%i)
#python new2000file.py
# stat 123 | grep Size
Size: 221184 Blocks: 536 IO Block: 4096 directory
# python -c "print 221184/4096"
54
复制一个100M的文件到目录123,结果该Size无变化
# du -sm /usr/lib/locale/locale-archive
102 /usr/lib/locale/locale-archive
#cp /usr/lib/locale/locale-archive /tmp/123/
#stat 123 | grep Size
Size: 221184 Blocks: 536 IO Block: 4096 directory
查看文件数量最多的目录
[root@localhost /]# find / -type d -exec stat {} \;| grep -e "Size\|File" | xargs -l2 | awk -F' ' '{print $4","$2}' | sort --sort=n -r | head -n 3
25518080,‘/test/111’
24576,‘/usr/share/man/man8’
20480,‘/usr/share/man/man1’
网友评论