如何在ext4上存储十亿个文件? [英] How to store one billion files on ext4?

查看:107
本文介绍了如何在ext4上存储十亿个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只创建了约800万个文件,所以/dev/sdb1中没有免费的inode.

I only created about 8 million files, then there was no free inode in /dev/sdb1.

[spider@localhost images]$ df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sdb1            8483456 8483456       0  100% /home

有人说可以在格式化分区时指定inode计数.

Someone says can specify the inode count when format the partition.

例如mkfs.ext4 -N1000000000.

e.g. mkfs.ext4 -N 1000000000.

我尝试过但出现错误:

"inode_size(256)* inodes_count(1000000000)太大...指定更高的inode_ratio(-i)或更低的inode计数(-N).".

"inode_size (256) * inodes_count (1000000000) too big...specify higher inode_ratio (-i) or lower inode count (-N). ".

合适的inode_ratio值是什么?

What's the appropriate inode_ratio value?

我听说ext4的最小inode_ratio值为1024.

I heard the min inode_ratio value is 1024 for ext4.

是否可以在一个分区上存储十亿个文件?如何?有人说这会很慢.

Is it possible to store one billion files on a single partition? How to? And someone says it will be very slow.

推荐答案

创建ext4文件系统时,可以指定使用类型:

When creating an ext4 file system, you can specify the usage type:

mkfs.ext4 -T usage-type /dev/something

/etc/mke2fs.conf中列出了可用的用法类型.这 用法类型之间的主要区别是inode比率.下层 inode比率,您可以在文件中创建的文件越多 系统.

The available usage types are listed in /etc/mke2fs.conf. The main difference between usage types is the inode ratio. The lower the inode ratio, the more you can create files in your file system.

mke2fs.conf中的用法类型分配最大数量的 文件系统中的inode是新闻".将此使用类型设为1 TB硬盘驱动器ext4可创建2.44亿个索引节点.

The usage type in mke2fs.conf which allocates the highest number of inodes in the file system is "news". With this usage type on a 1 TB hard drive, ext4 creates 244 million inodes.

# tune2fs -l /dev/sdb1 | grep -i "inode count"
Inode count:              244219904
# sgdisk --print /dev/sdb
Disk /dev/sdb: 1953525168 sectors, 931.5 GiB

这意味着创建ext4需要超过4 TB的存储空间 带有"-Tnews"的文件系统,可能容纳10亿个 索引节点.

This means that it would require more than 4 TB to create an ext4 file system with "-Tnews" that could possibly hold 1 billion inodes.

这篇关于如何在ext4上存储十亿个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆