如何查看MaxDir

空文件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’
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容