How To Increase Amount of Disk inodes in Ubuntu Linux?
It doesn't happen often, but at times you may run out of inodes on a Linux system.
To find your current inode usage, run
$ df -i
oracle@UBUNTU-H170N-WIFI:~$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 2033718 667 2033051 1% /dev
tmpfs 2039252 1311 2037941 1% /run
/dev/sda3 375360 25452 349908 7% /
/dev/sda4 1001712 181566 820146 19% /usr
tmpfs 2039252 87 2039165 1% /dev/shm
tmpfs 2039252 5 2039247 1% /run/lock
tmpfs 2039252 18 2039234 1% /sys/fs/cgroup
/dev/sda1 0 0 0 - /boot/efi
/dev/sda5 2752512 23171 2729341 1% /opt
/dev/sda6 1001712 41 1001671 1% /tmp
/dev/sda7 500960 11514 489446 3% /var
/dev/loop0 12819 12819 0 100% /snap/core/6673
/dev/sda8 670432 13657 656775 3% /home
/dev/loop2 35 35 0 100% /snap/canonical-livepatch/58
/dev/loop3 25385 25385 0 100% /snap/gtk-common-themes/1198
/dev/loop1 12816 12816 0 100% /snap/core/6350
/dev/loop7 27345 27345 0 100% /snap/gtk-common-themes/818
/dev/loop4 747 747 0 100% /snap/gnome-system-monitor/57
/dev/loop5 27631 27631 0 100% /snap/gnome-3-26-1604/82
/dev/loop6 27707 27707 0 100% /snap/gnome-3-28-1804/23
/dev/loop8 9862 9862 0 100% /snap/core18/782
/dev/sdb2 103911564 4040 103907524 1% /mnt/E030BF9830BF73DE
/dev/loop10 271 271 0 100% /snap/gnome-characters/206
/dev/loop9 27631 27631 0 100% /snap/gnome-3-26-1604/74
/dev/loop13 354 354 0 100% /snap/gnome-logs/57
/dev/loop11 1598 1598 0 100% /snap/gnome-characters/139
/dev/loop12 1269 1269 0 100% /snap/gnome-calculator/260
/dev/loop14 734 734 0 100% /snap/gnome-system-monitor/70
/dev/loop15 1720 1720 0 100% /snap/gnome-logs/45
/dev/loop16 1549 1549 0 100% /snap/gnome-calculator/352
/dev/sdb4 550191724 17424 550174300 1% /mnt/F6A4656DA46530F3
/dev/sdb3 81743792 6932 81736860 1% /mnt/7842F1D742F199D8
tmpfs 2039252 25 2039227 1% /run/user/121
tmpfs 2039252 45 2039207 1% /run/user/54321
/dev/sde1 0 0 0 - /media/oracle/SANTACRUZ
/dev/sdd1 0 0 0 - /media/oracle/TRANSCEND
To know more about inode exactly, refer Wikipedia has a good description.
A disk with 0 available inodes is probably full of very small files, somewhere in a specific directory (applications, tmp-files, pid files, session files, ...). Each file uses (at least) 1 inode. Many million files would use many million inodes.
If your disk's inodes are full, how do you increase it?
The answer is, you probably can't.
The amount of inodes available on a system is decided upon creation of the partition. For instance, a default partition of EXT3/EXT4 has a bytes-per-inode ratio of one inode every 16384 bytes (16 Kb).
A 10 GB partition would have around 622,592 inodes. A 100 GB partition has around 5,976,883.
Do you want to increase the amount of inodes?
Either increase the capacity of the disk entirely or re-format the disk using the following command:
$ sudo mkfs.ext4 -i <bytes-per-inode> # to manually overwrite the bytes-per-inode ratio.
What is bytes-per-inode?
Specify the bytes/inode ratio. 'mkfs.ext4' 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 number of inodes to maintain this ratio.
To know more about the command mkfs.ext4, go for man page with the command:
$ man mkfs.ext4
Also refer mke2fs - create an ext2/ext3/ext4 filesystem