Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Linux systems (Amazon EC2), what is the maximum number of files that can be stored in one directory without slowing down performance? (I know too many files in one directory on Windows systems will cause the system to operate slowly.)

share|improve this question
up vote 1 down vote accepted

Personally, I would keep the count under 30 000 to make sure I wouldn't have to worry about performance problems with any versions of ls or similar tools.

From a great answer on SO, here's the number of files you are able to keep, depending on your chosen file system (ext3 is default on Amazon Linux I think).


  • Maximum number of files: 268,435,437
  • Maximum file size: 4GB
  • maximum number of files per directory: 65535


  • Maximum number of files: 4,294,967,295
  • Maximum file size: 16TB currently (16EB theoretically)


  • Maximum number of files: 10¹⁸
  • Maximum file size: 2TB
  • theoretical file per directory limit: 1.3 × 10²⁰ files


  • Maximum number of files: number of bytes in volume/2¹³.
  • Maximum file size: 16GB (1KB block) to 2TB (4KB block)

Also, see this on performance problems with ls when using large directories.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.