Is there a limit on the number of files in UNIX in the filesystem?
Best Answer
It depends on the type of file system. If you're using ext4 with default parameters, then you can have a maximum of:
4 billion files total.
64000 subdirectories in a single directory.
Maximum of 16TB for a single file.
Some of these are configurable and are obviously limited by actual storage space on your medium. Best to read the documentation for your filesystem type.
If you're talking about the number of file handles a process can have open at once then it depends on your system. ulimit -a will tell you on a Linux system and is likely to default to 1024.
Note: numbers were taken from the ext4 wikipedia page.
MS FAT-based filesystems have a limit to the number of files that can be stored in the root directory (a few hundred IIRC), and because of the way long filenames are stored file/directory names longer then the traditional "8+3" wil consume more then on of the entries in the limit.
For subdirectories FAT32 allows ~65,000 entries per sub-directory (again, long filenames take more than one slot), I'm not sure about the older FAT16. Other filesystems have similar limits (ext2/3 has a 32,000 entry limit without certain tweaks) some do not or effectively do not (NTFS allows ~4,000,000,000). You will hit performance issues on some filesystems long before you hit the limit of entries per directory, as some search directories linearly (FAT* do, ext2 does, ext3 does unless you specific indexed directories, ext4 and NTFS do indexed directories by default IIRC).
Note: Assuming NTFS, as no one in their right mind would use FAT for anything else than USB thumb drives or memory cards, let alone on a server (ok, that thought is scary).
Yes, there is a limit. Storing more files than particles in the universe may prove impractical. However, the actual limit is far lower.
30,000 aren't that many files, actually. But Microsoft recommends that you turn off auto-generation of DOS-compatible short names if you move past 300,000 as finding a unique short name gets difficult then.
Best Answer
It depends on the type of file system. If you're using ext4 with default parameters, then you can have a maximum of:
Some of these are configurable and are obviously limited by actual storage space on your medium. Best to read the documentation for your filesystem type.
If you're talking about the number of file handles a process can have open at once then it depends on your system.
ulimit -a
will tell you on a Linux system and is likely to default to 1024.Note: numbers were taken from the ext4 wikipedia page.