A database server shows `EXT4-fs warning: ext4_dx_add_entry: Directory index full!` and inserts start failing.
AdvancedTroubleshootingDisk space, inodes and filesystems
Answer
Likely causes → A single directory has reached the ext4 htree limit (millions of entries).
Diagnose →
dmesg -T | grep -i 'index full'
sudo find /data -xdev -type d -exec sh -c 'echo "$(ls -f "$1" | wc -l) $1"' _ {} \; | sort -rn | head
sudo tune2fs -l /dev/sdb1 | grep features
Fix → Move files into subdirectories. On newer kernels you can enable large_dir: tune2fs -O large_dir /dev/sdb1 (check kernel and e2fsprogs support first).
Prevent → Application-level directory sharding; alert on directory entry counts.
More on Disk space, inodes and filesystems
Writes fail with `No space left on device`, but `df -h` shows the filesystem is only 40% used.Intermediate`df -h` shows `/` at 100%, but `du -sh /` only adds up to 12 GB on a 50 GB disk.Intermediate`du` and `df` disagree by 20 GB and `lsof +L1` shows nothing. What else could hide the space?AdvancedA cron job that runs `rm /var/spool/app/*` fails with `/bin/rm: Argument list too long`.Beginner`touch /data/test` returns `touch: cannot touch '/data/test': Read-only file system`.BeginnerAfter a power failure, mounting an XFS volume fails with `mount: /data: wrong fs type, bad option, bad superblock on /dev/sdb1`.Intermediate