Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a limit on the number of files in UNIX in the filesystem?

share|improve this question

migrated from stackoverflow.com Jan 16 '11 at 4:23

This question came from our site for professional and enthusiast programmers.

4  
In an individual directory? On a file system? Please be more specific. –  Brian Clapper Jan 16 '11 at 2:29

3 Answers 3

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.

share|improve this answer
    
And df -hi shows the current FS's inodes limit and its usage statistic. –  jweyrich Jan 16 '11 at 4:10

This depends on file system and container you are reffering to - in a directory, in a volume. Please refer to this link for details on EXT3 filesystem.

The maximum number of inodes (and hence the maximum number of files and directories) is set when the file system is created. If V is the volume size in bytes, then the default number of inodes is given by V/213 (or the number of blocks, whichever is less), and the minimum by V/223. The default was deemed sufficient for most applications. The max number of subdirectories in one directory is fixed to 32000.

Similar parameters are also defined for other filesystems.

share|improve this answer

If you are concerned with limitations, forget about them by using ZFS.

Quoted from ZFS FAQ:

What limits does ZFS have?
The limitations of ZFS are designed to be so large that they will never be encountered in any practical operation. ZFS can store 16 Exabytes in each storage pool, file system, file, or file attribute. ZFS can store billions of names: files or directories in a directory, file systems in a file system, or snapshots of a file system. ZFS can store trillions of items: files in a file system, file systems, volumes, or snapshots in a pool.

share|improve this answer

Your Answer

 
discard

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.