根据这个答案 ,可以用“无限”inode至less安装tmpfs。
考虑这个具体(数字select为例子的目的,我知道他们是不现实的)情况:
nr_inodes=1000安装tmpfs 这意味着tmpfs已经满了50%,但是任何写入的尝试都会导致空间不足错误。
在我看来,设置nr_inodes=0 (又名无限inode)会使这种情况消失。
通常(例如: ext2 , ext3 , ext4 , ufs ),文件系统可以容纳的inode数量在创build时设置,所以没有安装选项可以解决这个问题。
有些文件系统(如xfs的inode使用的空间比率是可调的,所以可以随时增加。
现代文件系统(如ZFS或btrfs对文件系统可以存储的文件数量没有硬编码限制,可以根据需要创buildinode(或其等同物)。
编辑:缩小更新问题的答案。
对于tmpfs ,inode的缺省数量被计算得足够大,以适应大多数实际使用情况。 如果在tmpfs上创build了大量空文件,则此设置不是最佳的唯一情况。 如果在这种情况下,最好的做法是将nr_inode参数调整为足够大的值,以使所有文件都适合,但不能使用0 (= unlimited)。 tmpfs 文档指出,这不应该是默认设置,因为非root用户可能会耗尽内存。
if nr_inodes=0, inodes will not be limited. It is generally unwise to mount with such options, since it allows any user with write access to use up all the memory on the machine; but enhances the scalability of that instance in a system with many cpus making intensive use of it.
但是,由于事实上tmpfs内存使用率默认限制在内存的50%
size: The limit of allocated bytes for this tmpfs instance. The default is half of your physical RAM without swap. If you oversize your tmpfs instances the machine will deadlock since the OOM handler will not be able to free that memory.
像Madhatter说的那样,inode占据了一些空间,在讨论使用无数的空间时,这并不是一个微不足道的数字。