ext2/ext3 32000限制

为什么有32000限制?
ext2/ext3有此限制,xfs无,reiserfs限制数量要大些.

mkdir: cannot create directory `test`: Too many links。

I already talked to Drew, there is a limit of 32,000 links in an inode,
which in turn limits the number of directories in a single place to 31,998

There is no way to increase this in ext2 without changing the inode format,
which will not happen before a little while

Solutions:
1) use base/d/di/directoryname name splits
2) use another filesystem (note that the default filesystem on freebsd, and
probably many other FS do also have a limit of 32K directories or
somesuch, so for portability, you want solution #1)
另外,同一个目录下的文件不要太多,听说超过1000个文件或目录时读取速度就有些影响了。

限制来源于:
./linux/ext2_fs.h:
#define EXT2_LINK_MAX 32000

This limit comes from link count of ext2fs's.
You can change the definition of EXT2_LINK_MAX in
include/linux/ext2fs.h upto 32765 since struct inode.i_nlink is
unsigned short, and recompile your kernel.
But another normal kernel will not operate such too many linked files
and directories.


This is imposed by a number of issues:
- EXT2_LINK_MAX=32000 is checked for new subdirectories
- ext2 bg_used_dirs_count is a __u16
- inode->i_nlink (__kernel_nlink_t) is an unsigned short for some platforms

For stat (old interface) the st_nlinks count is also an unsigned short, so
we _should_ be able to increase EXT2_LINK_MAX to 65500 or so safely. The
VFS will have problems if you increase the max link count over 65535 because
__kernel_nlink_t is __u16.

I see that reiserfs plays some tricks with the directory i_nlink count.
If you exceed 64536 links in a directory, it reverts to "1" and no longer
tracks the link count.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值