Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

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

share|improve this question

migrated from Jan 16 '11 at 4:23

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .