Does POSIX limit the number of directories in the os root?

According to The Open Group's published standard, the only required directories are:

  • /
  • /dev, which contains console, null, and tty
  • /tmp, guaranteed writable but not necessarily preserved.

The Linux Foundation maintains a Filesystem Hierarchy Standard (FHS) which extends this to include the directories you will typically see on a Linux system:

  • /bin: Essential user command binaries
  • /boot: Static files of the bootloader
  • /dev: Device files
  • /etc: Host-specific system configuration
  • /home: User home directories (optional)
  • /lib: Essential shared libraries and kernel modules
  • /lib<qual>: Alternate format essential shared libraries (optional)
  • /media: Mount point for removable media
  • /mnt: Mount point for a temporarily mounted filesystem
  • /opt: Add-on application software packages
  • /root: Home directory for the root user (optional)
  • /run: Run-time variable data
  • /sbin: System binaries
  • /srv: Data for services provided by this system
  • /tmp: Temporary files
  • As well as the /usr hierarchy and the /var hierarchy

The FHS was designed to be as generic as possible, to allow for incorporation in any UNIX system. The additional directories are likely to exist in any reasonable system, but this is not mandated by POSIX.

However, note that The Open Group also states that

Strictly conforming applications shall not assume the ability to create files in any of these directories, unless specified below.

Since directories are really just files, this implies that a strictly conforming application will not create any files or directories at the root level. Therefore, POSIX does not necessarily limit what a distribution may place at the root level, but does seem to state that an application conforming to its specification cannot assume that it will be able to.


In 10.1 Directory Structure and Files, POSIX lists directories which must exist. But it specifies no limit on the number of other directories which can exist at the root-level of a filesystem.

For that matter, it does not appear to place limits on the size of other directories.

POSIX's attention in this area is focused on commonality rather than differences.


There is no limitation to the number of entries in a directory, either in POSIX or in typical Unix implementations. There may be an indirect limit for the number of subdirectories, which is the maximum hard link count (each subdirectory's .. entry is a hard link to the directory); that's 216 for many common filesystems, which limits a directory to 65533 subdirectories (at least for those filesystems that store .. entries explicitly). You'll start hitting poor performance before that. According to POSIX, an implementation is allowed to support only 8 hard links on a file (_POSIX_LINK_MAX), but no actual implementation is limited to 6 subdirectories. And anyway, on many filesystems, including ext4, the hard link count is not maintained for .. entries, so the only limit is how much space or how many inodes are available on the filesystem.

POSIX doesn't say much about the organization of files on the system. It only mandates the existence of a few files. The only mandatory entries in the root directory are /dev and /tmp. Other habitual Unix entries such as /usr, /var, /bin, /etc, /lib, /home, etc. are Unix conventions that are not codified by POSIX.

On Linux, the FHS codifies the classics and a couple more. Most Linux distributions stick to the FHS entries. Other Unix systems typically have mostly the same entries, maybe with a few differences, but the number is about the same.

System administrators may create more, although this is discouraged: there are well-defined places for most things (software goes under /usr or /opt, system data goes under /var, user data goes under /net, mount points go under /media or /mnt, etc.), so there is rarely any good reason to create new directories at the top level.