我正在尝试使用多线程在一个文件夹中写入10亿个文件,但接下来我的程序写了2000万个文件,我得到“设备上没有空间”。我没有关闭我的程序因为它仍在编写相同的文件。
我使用debian和EXT4作为文件系统。 是否有同样的人遇到这个问题,非常感谢你的帮助。
正在运行tune2fs -l /path/to/drive
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
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 260276224
Block count: 195197952
Reserved block count: 9759897
Free blocks: 178861356
Free inodes: 260276213
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1024
Blocks per group: 24576
Fragments per group: 24576
Inodes per group: 32768
Inode blocks per group: 2048
Flex block group size: 16
Filesystem created: ---
Last mount time: ---
Last write time: ---
Mount count: 2
Maximum mount count: -1
Last checked: ---
Check interval: 0 ()
Lifetime writes: 62 GB
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
Default directory hash: ---
Directory Hash Seed: ---
Journal backup: inode blocks
答案 0 :(得分:0)
检查这个问题 How to store one billion files on ext4?
你比没有工作的inode更少的块,虽然我认为这是你的问题中最少的。如果你真的想这样做(数据库会更好吗?)你可能需要查看其他ext4 zfs
的文件系统作为一个选项,每个目录允许2 ^ 48个条目,并且应该做你想要的
如果这个问题是https://serverfault.com/questions/506465/is-there-a-hard-limit-to-the-number-of-files-a-directory-can-have,那么使用ext4的每个目录的文件数量是有限制的