- Red Hat Enterprise Linux 5.6. or later
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- ext3 or ext4
- System log file contains the following messages (dependent on filesystem type ext3 or ext4):
kernel: EXT3-fs warning (device sdb1): ext3_dx_add_entry: Directory index full!
kernel: EXT4-fs warning (device dm-2): ext4_dx_add_entry: Directory index full!
- What does
ext[3/4]_dx_add_entry: Directory index fullmean?
There are a number of possible resolutions:
- Determine if a process is creating unexpected or unwanted files or directories.
- Remove unnecessary or unwanted files or directories.
- Reorganize files and directories within the filesystem to reduce the number of entries in each individual directory.
- Use shorter filenames.
- Change the block size of the filesystem. This option requires a re-format of the filesystem, since the block size cannot be changed once it is set.
CAUTION: Before re-formatting the filesystem backup any important files to another device as reformatting will recreate the filesystem metadata and not retain information about existing files. By default the ext3 block size for small volumes is 1024. If possible format the disk with 4096 bytes (4k) block size as follows:
# mkfs -t ext3 -b 4096 /dev/device
dir_indexoption of the filesystem.
Note: There is no need to unmount the file system.
CAUTION: Disabling this option may impact performance on lookups in large directories.
# tune2fs -O ^dir_index /dev/device
- To recreate the
# umount /dev/device # tune2fs -O dir_index /dev/device # e2fsck -D /dev/device
- To identify the directory, use the following
auditdrule. You can get the audit log of the rule with
ausearch -m syscall -k for_ext3_dx_add_entry_warning.
-a exit,always -F arch=b64 -S open -S openat -S creat -S link -S symlink -S mkdir -F exit=-ENOSPC -k for_ext3_dx_add_entry_warning
The 'directory index full' error will be seen if there are lots of files/directories in the filesystem so that the tree reaches its indexing limits and cannot keep track further.
The directory index is an additional tree structure which helps directory lookups, improving performance for huge directories.
There is a limit in ext3 and ext4 of the directory structure.
- A directory on ext3 can have at most 31998 sub directories, because an inode can have at most 32000 links. This is one cause of the warning.
- A directory on ext4 can have at most 64000 sub directories.
The size of each section of a directory index is limited by the filesystem's block size. If very long filenames are used, fewer entries will fit in the block, leading to 'directory index full' errors earlier than they would occur with shorter filenames. This can become a bigger problem when the filesystem's block size is small (1024-byte or 2048-byte blocks), but will occur with 4096-byte blocks as well.
For further information about directory indexing, you may refer to the following page : http://ext2.sourceforge.net/2005-ols/paper-html/node3.html
- Red Hat Enterprise Linux
- Learn more
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.