每个索引节点有多少字节?
我需要创建大量不是很大的文件(如 4kb、8kb)。 在我的计算机上这是不可能的,因为它占用所有 inode 高达 100%,并且我无法创建更多文件:(
$ df -i /dev/sda5
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda5 54362112 36381206 17980906 67% /scratch
我开始删除文件,这就是为什么它现在是 67%)
在我的文件系统(ext4)上,每个节点的字节数为 256
$ sudo tune2fs -l /dev/sda5 | grep Inode
Inode count: 54362112
Inodes per group: 8192
Inode blocks per group: 512
Inode size: 256
我想知道是否可以将此值设置得非常低,甚至低于 128(在重新格式化期间)。如果是,我应该使用什么值? 谢谢
I need to create a very high number of files which are not very large (like 4kb,8kb).
It's not possible on my computer cause it takes all inodes up to 100% and I cannot create more files :
$ df -i /dev/sda5
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda5 54362112 36381206 17980906 67% /scratch
(I started deleting files, it's why it's now 67%)
The bytes-per-nodes are of 256 on my filesystem (ext4)
$ sudo tune2fs -l /dev/sda5 | grep Inode
Inode count: 54362112
Inodes per group: 8192
Inode blocks per group: 512
Inode size: 256
I wonder if it's possible to set this value very low even below 128(during reformating). If yes,what value should I use?
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
每个 inode 的默认字节数通常为 16384,这是
/etc/mke2fs.conf
中的默认inode_ratio
(在创建文件系统之前读取)。如果您的索引节点用完了,您可以尝试例如:影响此问题的另一个选项是
-T
,通常是-T news
,这会进一步将其减少到 4096。 ,如果不重新创建或十六进制编辑,则无法更改 ext3 或 ext4 文件系统中的 inode 数量。 Reiser 文件系统是动态的,因此您永远不会遇到问题。
The default bytes per inode is usually 16384, which is the default
inode_ratio
in/etc/mke2fs.conf
(it's read prior to filesystem creation). If you're running out of inodes, you might try for example:Another option that affects this is
-T
, typically-T news
which further reduces it to 4096.Also, you can not change the number of inodes in a ext3 or ext4 filesystem without re-creating or hex-editing it. Reiser filesystems are dynamic so you'll never have an issue with them.
您可以通过将可用空间大小除以可用 inode 数量来找出大致的 inode 比率。例如:
You can find out the approximate inode ratio by dividing the size of available space by the number of available inodes. For example:
我在 mke2fs 手册页上找到了问题的解决方案:
-I inode-size
指定每个 inode 的大小(以字节为单位)。 mke2fs 默认创建 256 字节 inode。在 2.6.10 之后的内核和一些早期的供应商内核中,可以使用
大于 128 字节的索引节点用于存储扩展属性以提高性能。 inode-size 值必须是大于或等于 128 的 2 的幂。越大
inode-size 索引节点表将消耗的空间越多,这会减少文件系统中的可用空间,并且还会对性能产生负面影响。扩展
存储在大 inode 中的属性在旧内核中不可见,并且此类文件系统根本无法使用 2.4 内核安装。无法改变
创建文件系统后的此值。
您能够设置的最大值由您的块大小给出。
希望这可以帮助......
I have found solution to my problem on the mke2fs man page :
-I inode-size
Specify the size of each inode in bytes. mke2fs creates 256-byte inodes by default. In kernels after 2.6.10 and some earlier vendor kernels it is possible to utilize
inodes larger than 128 bytes to store extended attributes for improved performance. The inode-size value must be a power of 2 larger or equal to 128. The larger the
inode-size the more space the inode table will consume, and this reduces the usable space in the filesystem and can also negatively impact performance. Extended
attributes stored in large inodes are not visible with older kernels, and such filesystems will not be mountable with 2.4 kernels at all. It is not possible to change
this value after the filesystem is created.
The maximun you will be able to set is given by your block-size.
Hope this can help....