linux – 如何找到最大的(在条目中,而不是大小)ext4目录?
发布时间:2020-12-13 17:02:33 所属栏目:Linux 来源:网络整理
导读:Ubuntu 10.04.3 LTS x86_64,我在/ var / log / messages中看到以下内容: EXT4-fs warning (device sda3): ext4_dx_add_entry: Directory index full! 来自dumpe2fs的相关信息: Filesystem features: has_journal ext_attr resize_inode dir_index filetype
Ubuntu 10.04.3 LTS x86_64,我在/ var / log / messages中看到以下内容:
EXT4-fs warning (device sda3): ext4_dx_add_entry: Directory index full! 来自dumpe2fs的相关信息: Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Free blocks: 165479247 Free inodes: 454382328 Block size: 2048 Inode size: 256 我已经阅读了一些其他问题,例如ext3_dx_add_entry: Directory index full和rm on a directory with millions of files;那些让我觉得必须有一个目录,里面有大量的项目. 由于它是一个相当复杂的目录组织,我有一个基本问题:如何找到生成这些消息的目录? 解决方法
以下单行将为您提供每个目录中有多少文件的列表,并按前十名排序.它会从你当前的工作目录递归运行,所以我不建议你从/运行它,除非你完全不知道大目录的位置.
find . -type f | awk '{dir=gensub(/(.+/).+/,"1","g (file://1%22,%22g/)"); dir_list[dir]++} END {for (d in dir_list) printf "%s %sn",dir_list[d],d}d' | sort -nr |head 输出将类似于以下内容: [user@localhost ~]# find . -type f | awk '{dir=gensub(/(.+/).+/,d}d' | sort -nr | head 2048 ./test19/ 2048 ./test18/ 2048 ./test17/ 2048 ./test16/ 2048 ./test15/ 2048 ./test14/ 2048 ./test13/ 2048 ./test12/ 2048 ./test11/ 2048 ./test10/ 如果你有点担心运行这样的单行只搜索所有自己大小超过50k的目录.再次找到你的朋友: find ./ -type d -size +50k 如果您有多个挂载点,则df -i将帮助您缩小哪个挂载耗尽或已用完inode. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |