ext4_dx_add_entry:2006: Directory index full!

I have rarely had a problem with ext4. One problem that I continue to have is with the directory index filling up.

The first indicator will be a “no space left on device” from stdout when performing a filesystem operation, with both ‘df -h’ and ‘df -i’ showing plenty of space and inodes available. The big clue will be from syslog and dmesg output:

[2733052.412501] EXT4-fs warning (device dm-0): ext4_dx_add_entry:2006: Directory index full!

If you search for this error online, you’ll likely see some experts tell you that you need to drop and re-create the filesystem with a different configuration, use tune2fs to disable dir_index, or something like that. I’ve tried all of those and they work, but I don’t recommend them anymore for my particular use case.

The easiest way to resolve the problem, for me, is to move the directories and re-create them, and copy the contents back into them, deleting the old directory. The directory index fills up and does not reclaim space. (I tried ‘fsck.ext4 -D’ to optimize the filesystem and that did not work.)

This might work for a directory with no sub-directories:

mv $directory $directory.old && mkdir $directory && mv $directory.old/* $directory/

My use case is a huge amount of small files written and deleted daily, hundreds of thousands of 1-4k files.

This also occurs with the following error:

ext4_dx_add_entry:2003: Directory index full!

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *