Maximum number of files and folders in a single directory?

  • Posted on April 22, 2014
  • jjk2sfuAsked by jjk2sfu

Running ubuntu 12.04, what is the maximum number of files and folders a single directory can hold assuming that each files are pretty small ~1kb.

I need a way to store up to a million files in a single directory

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

The maximum number of files on your drive is limited by the inode limit. For example:

df -i

/dev/vda 1310720 230115 1080605 18% /

Shows that there are only about 1,080,000 free inodes (1,310,720 total and 230,115 used) on my droplet. So you would have to keep it under that.

You cannot currently change the number of inodes. DigitalOcean currently uses an inode ratio of 16kb meaning 20gb / 16kb = the max number of inodes. So more disk space would allow you to host more files.

You shouldn’t have a problem with a million files. There isn’t any specific limit on the number of files in a directory, but each file no matter how small take up at least on “inode.” The number of available inodes is related to the size of the disk. This does a good job of explaining it: <br> <br>