Recently, one of my servers has started to show this message in syslog:
Aug 24 17:11:46 host-53-114 kernel: EXT4-fs warning (device md126p5): ext4_dx_add_entry: Directory index full! Aug 24 17:11:46 host-53-114 kernel: EXT4-fs warning (device md126p5): ext4_dx_add_entry: Directory index full! Aug 24 17:11:46 host-53-114 kernel: EXT4-fs warning (device md126p5): ext4_dx_add_entry: Directory index full!
The message Directory index full! sound like inode’s problem. Type the following command to check
# df -i
Output
Filesystem Inodes IUsed IFree IUse% Mounted on /dev/md126p5 29974528 29956913 17615 100% / tmpfs 1003836 14913 988923 2% /dev/shm /dev/md126p1 128016 44 127972 1% /boot /dev/md126p3 262144 18 262126 1% /tmp
Maybe too much to fill up the inodes in the partition, so I need to find the directory
# cd / # for dir in `ls -1`; do echo $dir; find ./$dir -type f|wc -l; done
Output
cache 33 db 0 empty 0 games 0 lib 4486 local 0 lock 11 log 104 mail 0 ...
I found “/var/spool/postfix/maildrop/” has millions of files, so we need to delete. Have many case to delete millions of files but I highlight recommend following, the way is the fastest method to delete billions of files
# cd /var/spool/postfix/maildrop/ # nohup perl -e 'for(<*>){((stat)[9]<(unlink))}' &