Linux – How to increase max number of allocated inodes in Linux

centoslinux

I have a Centos 6 server that is running kernel 2.6.32-279.19.1.el6.x86_64.

I'm experiencing an issue in which the system is hitting the max number of allocated inodes. At this moment, inode-state returns this:

# cat /proc/sys/fs/inode-state
279522  48040   0       0       0       0       0

I have 48040 inodes free, but several times per day this server will hit the limit ( it's a busy database server ).

Please, note that I'm not talking about used inodes, those defined in the file system. This is fine since when I run df -i, usage is only 14%.

How can I increase the allocated inodes limit? I saw that inode-max was removed in kernel 2.2 and couldn't find any other parameter related to this.

— Edit —

The used filesystem is ext4 and here is the output of df -i:

# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda1            12804096 1783423 11020673   14% /
tmpfs                33062480      11 33062469    1% /dev/shm

Best Answer

when you create ext2/ext3/ext4/ file system ,you can use -N to specify the numbers of inode exactly. once the file system created , you can't change its value. but if you use LVM , you can still add inode numbers by expanding filesystem using resize2fs.