在一个文件夹中写入十亿个文件“(设备上没有剩余空间)”错误

问题描述 投票:-1回答:1

我正在尝试使用多线程在一个文件夹中写入10亿个文件,但接下来我的程序写了2000万个文件,我得到“设备上没有空间”。我没有关闭我的程序,因为它仍然编写相同的文件。

  • 我对“inode”没有任何问题,我只使用了7%。
  • 没有问题/ tmp,/ var / tmp,有空。
  • 我将fs.inotify.max_user_watches增加到1048576。

我使用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
c linux tcp filesystems client-server
1个回答
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的每个目录的文件数量是有限制的,你可能会遇到

© www.soinside.com 2019 - 2024. All rights reserved.