分区中的 inode 数量与分区应支持的最大 inode 数量不匹配
我们使用 Amazon EBS 在 3 级目录结构中存储大量小文件 (<10KB)。
~/lists# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 3.9G 5.5G 42% / tmpfs 854M 0 854M 0% /lib/init/rw varrun 854M 64K 854M 1% /var/run varlock 854M 0 854M 0% /var/lock udev 854M 80K 854M 1% /dev tmpfs 854M 0 854M 0% /dev/shm /dev/sda2 147G 80G 60G 58% /mnt /dev/sdj 197G 60G 128G 32% /vol
有问题的分区是 /vol (大小:200GB)
~/lists# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda1 655360 26541 628819 5% / tmpfs 186059 3 186056 1% /lib/init/rw varrun 186059 31 186028 1% /var/run varlock 186059 2 186057 1% /var/lock udev 186059 824 185235 1% /dev tmpfs 186059 1 186058 1% /dev/shm /dev/sda2 19546112 17573097 1973015 90% /mnt /dev/sdj 13107200 13107200 0 100% /vol
~/lists# sudo /sbin/dumpe2fs /dev/sdj | grep "Block size" dumpe2fs 1.41.4 (27-Jan-2009) Block size: 4096
分区 /vol 的 inode 数量超过 1300 万个。块大小为4096。以块大小为4096,200GB分区(ext3)应支持的inode数量为5200万+(最大Inode计算:卷大小以字节为单位/2^12)。那么为什么分区只支持1300万个inode呢?
We are using Amazon EBS to store a large number of small files (<10KB) in a 3-level directory structure.
~/lists# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 3.9G 5.5G 42% / tmpfs 854M 0 854M 0% /lib/init/rw varrun 854M 64K 854M 1% /var/run varlock 854M 0 854M 0% /var/lock udev 854M 80K 854M 1% /dev tmpfs 854M 0 854M 0% /dev/shm /dev/sda2 147G 80G 60G 58% /mnt /dev/sdj 197G 60G 128G 32% /vol
The partition in question is /vol (size: 200GB)
~/lists# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda1 655360 26541 628819 5% / tmpfs 186059 3 186056 1% /lib/init/rw varrun 186059 31 186028 1% /var/run varlock 186059 2 186057 1% /var/lock udev 186059 824 185235 1% /dev tmpfs 186059 1 186058 1% /dev/shm /dev/sda2 19546112 17573097 1973015 90% /mnt /dev/sdj 13107200 13107200 0 100% /vol
~/lists# sudo /sbin/dumpe2fs /dev/sdj | grep "Block size" dumpe2fs 1.41.4 (27-Jan-2009) Block size: 4096
The number of inodes for the partition /vol are 13Million+. The block size is 4096. Taking the Block Size as 4096, the number of inodes the 200GB partition (ext3) should support is 52million+ (Maximum Inode Calculation: Volume size in bytes/2^12). So why does the partition only support 13million inode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我非常确定当您创建卷时(在本例中使用 mfs.ext3),inode 是静态分配的。无论出于何种原因,mkfs.ext3 决定保留 1300 万个 inode,现在您无法创建更多文件。
请参阅 2001 年inode 的讨论,
维基百科 ext3 页面有一个脚注更简洁地解释了这一点:wiki 链接
另外,inode 是按文件(而不是块)分配的,这就是为什么只有 13M inode - mkfs.ext3 必须配置为平均文件大小为 8 KB,这可以解释您所看到的问题。
I'm pretty sure that inodes are allocated statically when you create the volume (using mfs.ext3 in this case). For whatever reason, mkfs.ext3 decided to reserve 13 Million inodes and now you can't create any more files.
See this 2001 discussion of inodes
The Wikipedia ext3 page has a footnote explaining this more concisely: wiki link
Also, inodes are allocated per file (not block), which is why there are only 13M inodes - mkfs.ext3 must have been configured with an average file size of 8 KB which would account for the issue you're seeing.