0

Let's assume I was very unlucky and ran out of inodes in my ext4 filesystem but left with enough free space.

Inode usage is 100%, but it has 50% disk free space.

How can I resolve it?

firdavs
  • 21
  • related: https://unix.stackexchange.com/questions/26598/how-can-i-increase-the-number-of-inodes-in-an-ext4-filesystem and precisely this comment: https://unix.stackexchange.com/questions/26598/how-can-i-increase-the-number-of-inodes-in-an-ext4-filesystem#comment35923_26600 . Ratio can't be changed. But growing the filesystem will thus also increase inode capacity. As I guess you want this without growth, I'm just leaving a comment (it's probably a duplicate). – A.B Mar 04 '24 at 17:34

1 Answers1

1

One option is to recreate your filesystem specifying bytes-to-inode ratio with -i option.

  1. Backup all of your data to another disk.

  2. List your filesystems and find the one you want to modify:

    $ df -h

    assuming that filesystem is /dev/sdX and is mounted on /mnt/mountpoint.

  3. Unmount that filesystem:

    $ umount /mnt/mountpoint

  4. Create that filesystem using mkfs.ext4 command specifying -i byte-to-inode ratio:

    $ mkfs.ext4 -i 4096 /dev/sdX

    This command will create ext4 filesystem with 4 KB per inode ratio (which will create four times more inodes than the default value - 16 KB per inode).

  5. Mount that filesystem:

    $ mount /dev/sdX /mnt/mountpoint

firdavs
  • 21