Quick Question: How many files can you have in a Linux Server folder?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • $5 submissions
    I help you SUCCEED
    • Nov 2003
    • 32189

    #1

    Quick Question: How many files can you have in a Linux Server folder?

    I'm building thousands of pages but the way the script is designed, all the html files must be in one directory. Anyone know if there's a limit in Linux re how many files can be in a directory?
  • Jace
    FBOP Class Of 2013
    • Jan 2004
    • 35562

    #2
    i have had upwards of 15,000 before...never had a problem

    Comment

    • Nembrionic
      Confirmed User
      • Feb 2003
      • 2424

      #3
      http://www.google.com/search?hl=en&q...irectory+linux


      will give this as one of the pages:
      http://www.uwsg.iu.edu/hypermail/lin...05.0/0164.html

      now that was hard! :D

      Comment

      • Nembrionic
        Confirmed User
        • Feb 2003
        • 2424

        #4
        Ofcourse it depends on your FS and maybe even your linux flavor

        Comment

        • $5 submissions
          I help you SUCCEED
          • Nov 2003
          • 32189

          #5
          Originally posted by JaceXXX
          i have had upwards of 15,000 before...never had a problem
          Thanks, Jace, much appreciated.

          Comment

          • mortenb
            Confirmed User
            • Jul 2004
            • 2203

            #6
            I recently saw a system getting unstable at around 30k pics in a folder

            Comment

            • toddler
              Confirmed User
              • Jun 2002
              • 1911

              #7
              it depends more on how your server parses the files vs just the raw counts. For longterm managability, use sub dirs. scripts parsing many thousands of files in a single directory could very well have problems with the size of the arrays. Use sub dirs...
              http://www.flickr.com/photos/zoddler/

              Comment

              • azguy
                Confirmed User
                • Nov 2004
                • 5167

                #8
                Depends on the Linux distro and kernel version, but I don't think you'll have a problem any time soon

                Comment

                • fuzebox
                  making it rain
                  • Oct 2003
                  • 22356

                  #9
                  The limit under ext3 is 32768 files/subdirectorys in one directory

                  Comment

                  • zagi
                    Confirmed User
                    • Jan 2004
                    • 1238

                    #10
                    The limits change from one OS to another, but one thing is true, Unix + Linux is notoriously bad with a large number of files in one directory.

                    I would have to estimate the upper limit between 20,000 - 30,000 after that performance suffers heavily. Yes the script may not use sub directories but it can always be modified. Usuaully you wont notice until its too late and then rewriting + sorting archived files is a big pain.

                    Take this into account before going production with this system would be my advice.

                    Under FreeBSD you can tune the following sysctl variables to increase performance for large # of files in a directory:

                    vfs.ufs.dirhash_minsize: 2560
                    vfs.ufs.dirhash_maxmem: 2097152
                    Managed US/NL Hosting [ [Reality Check Network ]
                    Dell XEON Servers + 1/2/3 TB Packages ICQ: 4-930-562

                    Comment

                    • swedguy
                      Confirmed User
                      • Jan 2002
                      • 7981

                      #11
                      32,768 for both ext2 and ext3. I found that out the hard way with an old redirecting service

                      Comment

                      • goBigtime
                        Confirmed User
                        • Nov 2002
                        • 7761

                        #12
                        If you have to ask that question, then you should probably rework your application to use subdirs. Dealing with directories with that many files can waste a lot of resources.

                        The easiest way might be to create folders named 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z and rewrite your script to seek/store the files in that manner.

                        But it really depends on your application and file naming scheme.

                        Comment

                        • esteve
                          Confirmed User
                          • May 2004
                          • 233

                          #13
                          I have about 150,000 files under a folder in windows, No they're not all in one huge line but /asian/10/ /anal/01/
                          dunno if that helps
                          * JayManCash * Raven Riley * Liz Vicious *Toni KatVixen * Bangin Becky *
                          * Duke Dollars * Facial Abuse * Ghetto Gaggers *

                          Comment

                          Working...