What is the meaning of the default directories in the Linux filesystem hierachy?

The brief answer about directory names: type "man hier" into a terminal :)

That's the man page for the filesystem hierarchy, which explains the general purpose of the directory names and what they hold. You can see a web version here.

There's also more reading on Wikipedia:

  • http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

Those links will explain everything about what partitions are called what and what they are (or were historically) used to store.

The answer about using seperate partitions rather than just directories in the same partition comes back to maintainability and expandability. If you've got one partition with, say, / and /home on it, Joe User can fill up his /home/joe folder, and the entire machine will run out of disk space and stop working (I'm simplifying here, but that's the general result). If you've got / and /home on different partitions, Joe User can fill up his /home/joe folder, and the /home partition will be full, but the machine will continue to operate because / is not affected.

So expand that principle out to almost all different directories being on different partitions, and you can see how it would be useful, particularly when a machine is running 24/7 in a multi-user and multi-service role.


When installing, many distributions give you the options to put different directories on different partitions. For example, a lot of users choose to have the /home directory on a different partition than the rest of the installation. This is because everything in the /home directory belongs to a user--documents, videos, and all other user-specific data goes here. By putting the /home directory on a separate partition, and the actual OS files on another, if a user decides to do a fresh install of his Linux operating system, he can just rewrite the main partition and leave his /home partition (and all of his files) intact.

This also allows a user to install multiple Linux distributions on different partitions, all sharing the same /home partition. This way, a user can access his files no matter what Linux version he's using.

A casual user shouldn't really have to worry too much about assigning a separate /var, swap, /usr, etc. All of these directories are part of the OS, and have little to do with the user's files.


Using the whole available disk space is a perfectly valid (and probably the recommended) option for Personal computers. Partitioning the filesystem like that is in my opinion a layover from ancient times before RAID or virtual volume management were practical in software.

In UNIX-like systems the filesystem starts at the root directory '/'. In the DOS/Windows terms that would be 'C:'

While in DOS/Windows you add drives to dive letters D:, E:, etc. In UNIX-like systems you 'mount' drives into directories. Back in the day when you had 10 or 10 megabyte hard drives you could mount various directories in different drives and partitions to give the illusion of a single large drive. Pretty much a poor-man's RAID 0.

There are many reasons to partition out the various root directories but one popular idea is that since the swap and /var partitions were written to the most they have the highest chance of failing. By separating them out into different partitions it's really easy to just add another drive from backup and re-mount it.

Also having a separate /home parition can be really great if you run multiple versions of linux on one machine. (For example Ubuntu and Red Hat). Since Unix/Linux programs place the user's settings inside his or her home directory. This works much better in theory than in practice though. Because you need to thoroughly understand the permissions implications.

Here are a few important directories for UNIX-like operating systems and their explanations.

  • /bin - Basic system executable files
  • /lib - Basic system libraries (.so in Linux, .dlls in Windows).
  • /boot - Where you're kernel lives. Computer wont start without this one.
  • /var - Directory were services can store files. Like log files and mailboxes
  • /etc - System configuration files
  • /usr - Non-essential user applications. (A unix-system can boot without a /usr (for recovery purposes) but it would not be very fun. In older systems this is the same as /home.)
  • /home - User's home directories. Normal users can only write to their own home directory.
  • swap (not a directory) This is usually a separate partition in UNIX. There is no swap directory, although you can make swap-files in Linux.

Tags:

Partitioning