How many the number of files is acceptable per one directory?

As the number of files per directory increases, the processing time for metadata operations (file creation, deletion, and opening) on the files under the directory increases, or the file system may generate errors, making it impossible to create files.

Even when using a group disk, it is recommended to arrange files in a hierarchical manner so that there are no more than 100,000 files per directory.

Example:

 

  • NG: 000000.dat ~ 999999.dat
    • If a million files are placed flat in one directory, the load during file access will increase, causing performance degradation and failure.
  • OK: 000/000000.dat ~ 000/000999.dat, 001/001000.dat ~ 001/001999.dat, …
    • The hierarchical arrangement minimizes the cost of file system operations by limiting the number of files per directory to about 1000.