How to increase the inode size
It's not possible to increase the number of inodes after the filesystem has been formatted. From the mke2fs manpage:
Be warned that it is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter.
Your only option is to keep adding more space (which has the side effect of adding more inodes), or creating and migrating to a new filesystem with a lower bytes-per-inode ratio.
Related videos on Youtube
Alaa Alomari
Updated on September 18, 2022Comments
-
Alaa Alomari over 1 year
I have Ubuntu 11.10 Server 64bit. my clients upload a lot of small xml files on my server. and my business needs all of those files. I have storage space, but the problem is in inode size. by running
df -ih
anddf -h
, I getdf -ih Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/vg0-lv0 4.7M 3.3M 1.5M 70% / udev 2.0M 475 2.0M 1% /dev tmpfs 2.0M 374 2.0M 1% /run none 2.0M 3 2.0M 1% /run/lock none 2.0M 1 2.0M 1% /run/shm /dev/sda1 122K 232 122K 1% /boot /dev/mapper/vg0-lv1 6.3M 600K 5.7M 10% /var
df -h df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg0-lv0 74G 40G 35G 54% / udev 7.9G 4.0K 7.9G 1% /dev tmpfs 3.2G 288K 3.2G 1% /run none 5.0M 0 5.0M 0% /run/lock none 7.9G 0 7.9G 0% /run/shm /dev/sda1 228M 46M 171M 22% /boot /dev/mapper/vg0-lv1 99G 40G 55G 43% /var
as you see, the root partition has about 50% free space while it has 30% free inode.
is there anyway to override this problem? can i resize or increase the indoe size. by the way, i have raised this lvm partition by 20G (lvresize) to get some free inodes for now!! but this is not a solution any idea about this is highly appreciated. -
Alaa Alomari about 11 yearsext filesystem will not affect inode... this is what i know!! ext3 and ext4 gives one inode for every 16K... please correct me if i am wrong
-
mgorven about 11 years@AlaaAlomari The 16K is the default bytes-per-inode ratio, which can be set when the filesystem is created. If you can create a new filesystem and move your data there, you can use a lower bytes-per-inode ratio in order to have more inodes.
-
Alaa Alomari about 11 yearsThanks Mgorven,,, this partition is root partition!! so is it possible to create another partition and mount it as root in fstab?? if so, what shall i be aware of during this process? Thanks a lot for your help
-
ddm-j about 3 years@AlaaAlomari, I'd mount another file system with more inodes to the place where all the small files are, and leave the root file system alone (maybe shrink it to make space for the other file system). The main reason people use separate file systems in different mount points is so they can tune them differently. Usenet servers typically have /var/spool with one inode per 4k, for example. The Debian installer in Expert mode asks for the expected usage (spool, normal, archive) and adjusts the number of inodes to one per (1k, 16k, 4M).