Linux: Large Directories and Performance

Posted on 2011-10-17
Last Modified: 2012-05-12
I need to store about ten thousand files on a Linux web server.  The web path to the files will be stored in a database.  Would it be best for performance to place all the images in a single directory or would it be better to place them in randomly named sub-directories with less files in each sub-directory?  
Question by:hankknight
    LVL 20

    Accepted Solution

    With most modern file systems (anything that you will be using is 'modern') this is not much of an issue.
    It depends on what your system is running.
    Most of them are happy with about 10,000 but some like EXT2 will start to struggle about this point as there is no index for the directory tables.
    Ext3 or 4 would cope with no issue as would most other more modern Filesystems.

    type in
    if you want to see how it is formatted and mounted.

    LVL 30

    Expert Comment

    by:Kerem ERSOY
    Only I am not sure EXT3 would perform better than EXT2. They are the same except for EXT3 has a journal file over the top of EXT2.

    EXT4 is a different story and it can support so many files and perform faster than EXT3 so I suggest you to use EXT4.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now