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.)

1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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