2

We are using below code to create folder in Linux server.

File dir = new File(filePath);
            if(!dir.isDirectory())
             dir.mkdirs();

After that creating files inside that programatically and writing into it.

But the problem is after certain size new files are not getting created.(Even free space is there in the folder).

Is there any restriction for no. of file or folder size? Please let me know how to check.

closed as too broad by G-Man, Jeff Schaller, Michael Homer, Philippos, peterph Mar 11 at 20:31

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    which linux ? ubuntu ? redhat ? mint ? which programming language ? C ? Python ? (doesn't look like shell nor php). – Archemar Oct 28 '15 at 7:33
  • 1
    First thing to check is whether all the inodes have been used up. Run df -i to check. – Mark Plotnick Oct 28 '15 at 10:02
8

There is a limit to the number of files that can be created in a partition, and in a directory.

I found the following information from here.

FAT32:

  • Maximum number of files: 268,173,300
  • Maximum number of files per directory: 216 - 1 (65,535)
  • Maximum file size: 2 GiB - 1 without LFS, 4 GiB - 1 with

NTFS:

  • Maximum number of files: 232 - 1 (4,294,967,295)
  • Maximum file size
    • Implementation: 244 - 26 bytes (16 TiB - 64 KiB)
    • Theoretical: 264 - 26 bytes (16 EiB - 64 KiB)
  • Maximum volume size
    • Implementation: 232 - 1 clusters (256 TiB - 64 KiB)
    • Theoretical: 264 - 1 clusters

ext2:

  • Maximum number of files: 1018
  • Maximum number of files per directory: ~1.3 × 1020 (performance issues past 10,000)
  • Maximum file size
    • 16 GiB (block size of 1 KiB)
    • 256 GiB (block size of 2 KiB)
    • 2 TiB (block size of 4 KiB)
    • 2 TiB (block size of 8 KiB)
  • Maximum volume size
    • 4 TiB (block size of 1 KiB)
    • 8 TiB (block size of 2 KiB)
    • 16 TiB (block size of 4 KiB)
    • 32 TiB (block size of 8 KiB)

ext3:

  • Maximum number of files: min(volumeSize / 213, numberOfBlocks)
  • Maximum file size: same as ext2
  • Maximum volume size: same as ext2

ext4:

  • Maximum number of files: 232 - 1 (4,294,967,295)
  • Maximum number of files per directory: unlimited
  • Maximum file size: 244 - 1 bytes (16 TiB - 1)
  • Maximum volume size: 248 - 1 bytes (256 TiB - 1)
  • 1
    Maximum number of files per directory: ~1.3 × 10^20 is greater than Maximum number of files: 10^18, is this correct? – Freewind Dec 4 '18 at 15:41
  • Maximum number of files per directory: ~1.3 × 10^20 is greater than Maximum number of files: 10^18, is this correct ... Why this strange behaviour? – Sir Jo Black Feb 9 at 19:06

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