Can I increase inode count in Linux?

I have a Linux MIPS router with 2.4.17 kernel. Root fs is a tmpfs and /rom is a cramfs. There is 4MB free memory and 3MB free on tmpfs.

I can create a few new empty files, but the next ones fail with "not enough space". However, I can append 1MB of data to an existing file. So my trouble is in inode count.

And my questions:

  1. Is there any way to dynamically increase inodes?
  2. If I can't increase it dynamically - Where can I increase it in kernel sources?

If the inode count is your actual issue, you can increase the amount of available inodes for the tmpfs filesystem with the nr_inodes mount option. If you set nr_inodes=0 , then there will be unlimited inodes.

All this information is in the tmpfs kernel documentation.

See womble's answer for remount example. For boot, you will need to edit your fstab, or whatever does this for your particular Linux build so future mounts are handled correctly.


You can set the number of inodes available in a tmpfs with the nr_inodes mount option. To do this live, you can just run:

mount -o remount,nr_inodes=<bignum> /tmp

I suspect that setting this number very, very large will result in a lot of memory consumption, so be careful.