Yes you can consume all the inodes of a system. They are a limited resource just like diskspace is, and they're pre-allocated when you perform a mkfs.ext4
, for example.
You can use tools such as tune2fs -l <device>
or df -i <path>
to see how many are allocated and used.
Example
$ df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora-root 3276800 355850 2920950 11% /
So this filesystem has 2920950 inodes free. If I started making files, directories, or links on the filesystem, that would be all I needed to do to consume them all. Realize that I could consume all these inodes with small files or links, and still have roughly all the diskspace still available to me.
Consuming inodes without files?
I'm not sure what you're getting at here, but the only way I'm aware of, where you can consume inodes is to create files, directories, or links. I'm not familiar with any other way to consume them.
Example
Here you can see I'm consuming 1 inodes when I create a empty directory.
$ df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora-root 3276800 355850 2920950 11% /
$ sudo mkdir /somedir
$ df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora-root 3276800 355851 2920949 11% /
The easiest way to consume the inodes is likely to make a directory tree of directories.
$ sudo mkdir /somedir/1
$ df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora-root 3276800 355852 2920948 11% /
$ sudo mkdir /somedir/2
$ df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora-root 3276800 355853 2920947 11% /
$ sudo mkdir /somedir/3
$ df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora-root 3276800 355854 2920946 11% /
Here's another example where I'm consuming inodes by creating several links using ln
tothe same file.
$ ln -s afile ln1
$ df -i .
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora_greeneggs-home 26722304 1153662 25568642 5% /home
$ ln -s afile ln2
$ df -i .
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora_greeneggs-home 26722304 1153663 25568641 5% /home
$ ln -s afile ln3
$ df -i .
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/fedora_greeneggs-home 26722304 1153664 25568640 5% /home
Yes. See man mkfs.ext4
:
-i bytes-per-inode
Specify the bytes/inode ratio. mke2fs creates an inode for
every bytes-per-inode bytes of space on the disk. The larger
the bytes-per-inode ratio, the fewer inodes will be created.
This value generally shouldn't be smaller than the blocksize of
the filesystem, since in that case more inodes would be made
than can ever be used. Be warned that it is not possible to
change this ratio on a filesystem after it is created, so be
careful deciding the correct value for this parameter. Note
that resizing a filesystem changes the numer of inodes to maintain this ratio.
I verified this experimentally, resizing from 1G to 10G and looking at tune2fs /dev/X | grep Inode
. The inode count went from 64K to about 640K.
I believe it's a natural consequence of Unix filesystems which use "block groups". The partition is divided into block groups, each of which has their own inode table. When you extend the filesystem, you're adding new block groups.
Best Answer
It seems that you have a lot more files than normal expectation.
I don't know whether there is a solution to change the inode table size dynamically. I'm afraid that you need to back-up your data, and create new filesystem, and restore your data.
To create new filesystem with such a huge inode table, you need to use '-N' option of mke2fs(8).
I'd recommend to use '-n' option first (which does not create the fs, but display the use-ful information) so that you could get the estimated number of inodes. Then if you need to, use '-N' to create your filesystem with a specific inode numbers.