我使用 MBR 分区方案为 WD WD800BB-55JHA0 80GB 硬盘创建了一个主分区。在这个分区中,我创建了一个带有 200048640 个 inode 的 ext4 文件系统!然后我用命令创建了很多非常小的文件while true; do echo a > /media/$RANDOM$RANDOM$RANDOM; done
。在某些时候我无法添加更多文件:
sh-4.2# strace echo a > /media/$RANDOM$RANDOM$RANDOM
该文件未创建,并且没有输出到 shell。它就永远挂在那里。
的输出dumpe2fs /dev/sdb1
如下所示:
Filesystem volume name: <none>
Last mounted on: /media
Filesystem UUID: 233d7f5b-51b0-4c3d-8f1d-5d8c34f08a8f
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
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
Default mount options: user_xattr acl
Filesystem state: clean with errors
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 200048640
Block count: 19536000
Reserved block count: 976871
Free blocks: 6665698
Free inodes: 199748660
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1024
Blocks per group: 3200
Fragments per group: 3200
Inodes per group: 32768
Inode blocks per group: 2048
Flex block group size: 16
Filesystem created: Thu Jan 5 11:20:15 2006
Last mount time: Thu Jan 5 11:48:02 2006
Last write time: Thu Jan 5 11:53:15 2006
Mount count: 1
Maximum mount count: -1
Last checked: Thu Jan 5 11:20:15 2006
Check interval: 0 (<none>)
Lifetime writes: 3540 MB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
First orphan inode: 280161
Default directory hash: half_md4
Directory Hash Seed: 84caa27e-4e4c-4853-b222-e739c0fda1de
Journal backup: inode blocks
FS Error count: 1
First error time: Thu Jan 5 11:53:15 2006
First error function: ext4_mb_generate_buddy
First error line #: 741
First error inode #: 0
First error block #: 0
Last error time: Thu Jan 5 11:53:15 2006
Last error function: ext4_mb_generate_buddy
Last error line #: 741
Last error inode #: 0
Last error block #: 0
Journal features: (none)
Journal size: 128M
Journal length: 32768
Journal sequence: 0x000000c7
Journal start: 29840
显然我没有用完 inode,并且还有足够的空间来创建更多文件:
sh-4.2# df -i /dev/sdb1
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sdb1 200048640 299980 199748660 1% /media
sh-4.2# df /dev/sdb1
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 28079472 1416684 22755304 6% /media
sh-4.2#
什么可能限制新文件?每个目录的文件数量有限制吗?