Optimal dir strcuture for keeping millions of files on an ext4 system

Posted by Alex Flo on Server Fault See other posts from Server Fault or by Alex Flo
Published on 2012-10-15T09:25:03Z Indexed on 2012/10/15 9:39 UTC
Read the original article Hit count: 255

Filed under:
|
|

I need to keep millions of files on an ext4 system.
I understand that having a structure with multiple subdirectories is the general accepted solution. I wonder what would be the optimal approach in terms of number of dirs/subdirs.
For example I tried a structure like 16/16/16/16 (that is, (sub)directories from 1 to 16) and I found that I am able to move 100K files to this structure in 2m50s.
When trying to move 100K files to a 8/8/8/8/8/8 structure it took 11 minutes. So the 16/16/16/16 approach seems to be better but I was wondering if anyone has some empirical experience with an even better dir/subdir distribution.

© Server Fault or respective owner

Related posts about linux

Related posts about filesystems