Maximum number of sub-directories in ext4
April 12 2011 15:00 CET
A great thing about Debian Squeeze is that ext4 support is now in the kernel. That means we can utilize some of those new sweet features.
At work we are only running ext4 on new servers. For instance this gives us the much needed advantage of going over 32,000 subdirectories in a directory.
Although this should also be possible in ext3 with the dir_nlink feature we never investigated it further. Instead a lot of our internal systems utilized
a hashing method so e.g. you would hash the directory name and thereby limit the numbers of subdirectories.
So how many subdirectories does ext4 support?
A quick test:
mkdir /test
cd /test
for i in {1..100000} ; do mkdir $i ; done
100,000 directories? No problem. But do note that above 65,000 directories the inode link count is set to 1 and no longer “counts subdirectories”.
What does this mean for me? Well, probably nothing. But if you think I am wrong, please leave a comment :)
For more information please see the git commit removing the 65,000 limit.
Comments