The File System Explained

Now that you understand the principles of files and users, we can take a bird's-eye view of the Linux file system and start to make sense of it.

You might already have ventured beyond the /home directory and wandered through the file system. You no doubt found it thoroughly confusing, largely because it's not like anything you're used to. The good news it that it's not actually very hard to understand. If nothing else, you should be aware that nearly everything can be ignored during everyday use.


The SUSE Linux file system is referred to as a hierarchical file system. This means that it consists of a lot of directories that contain files. Windows also uses a hierarchical file system. SUSE Linux refers to the very bottom level of the file system as the root. This has no connection with the root user.

You can switch to the root of the file system by typing the following shell command:

cd /

When used on its own, the forward slash is interpreted as a shortcut for root.

If I do this on my PC and then ask for a long file listing (ls -l), I see the following:

[knthomas@testpc knthomas]$ cd /  [knthomas@testpc /]$ ls -l total 223  drwxr-xr-x    2 root   root    2840 2004-06-11 17:14 bin  drwxr-xr-x    3 root   root     544 2004-08-05 09:34 boot  drwxr-xr-x   34 root   root  180096 2004-08-07 07:17 dev  drwxr-xr-x   63 root   root    6064 2004-08-07 07:18 etc  drwxr-xr-x    4 root   root      96 2004-06-14 15:14 home drwxr-xr-x   12 root   root    3096 2004-06-11 17:13 lib  drwxr-xr-x    6 root   root     176 2004-06-11 16:29 media drwxr-xr-x    2 root   root      48 2004-04-06 17:04 mnt  drwxr-xr-x   10 root   root     304 2004-06-17 12:40 opt  dr-xr-xr-x  143 root   root       0 2004-08-07 08:16 proc  drwx------   25 root   root    1000 2004-08-06 15:44 root drwxr-xr-x    3 root   root    7696 2004-08-05 09:34 sbin  drwxr-xr-x    4 root   root      96 2004-06-11 16:11 srv  drwxr-xr-x    8 root   root       0 2004-08-07 08:16 sys  drwxrwxrwt   81 root   root    3488 2004-08-07 12:15 tmp  drwxr-xr-x   12 root   root     344 2004-06-11 16:19 usr  drwxr-xr-x   15 root   root     384 2004-06-14 11:32 var

The first thing you'll notice from this is that the root of the file system contains nothing but directories and that they're all owned by root.

Only the root user can write files to the root of the file system. This is to prevent damage from ordinary users, since most of the directories in the root of the file system are vital to the correct running of Linux and contain essential programs or data.


It's incredibly easy to slip up when using the command-line shell and thereby cause lots of damage. For example, simply mistyping a forward slash in a command can mean the difference between deleting the files in a directory and deleting the directory itself. This is just another reason why you should always work as a standard user and log in as root only when it's absolutely necessary. It also explains why, by default, all the system directories are owned by the root user and protected against ordinary users making changes to them.

As you can see from the file permissions of each directory in the root of the file system, most directories allow all users to browse them and access the files within (the last three characters of the permissions read r-x). You just won't be able to create new files there or delete the directories themselves. You might be able to modify or execute programs contained within the directory, but this will depend on the permissions of each individual file.

Table 15-3 provides a brief description of what each directory in the SUSE Linux root file system contains. This is for reference only; there's no need for you to learn this information.

Table 15-3. Directories in the SUSE Linux Root File System




Vital tools necessary to get the system running or for use when repairing the system and diagnosing problems


Boot loader programs and configuration files (the boot loader is the menu that appears when you first boot Linux)


Virtual files representing hardware installed on your system


Central repository of configuration files for your system


Where each user's personal directory is stored


Shared system files used by Linux as well as the software that runs on it


Where the directories representing various mounted removable storage devices are made available


Directory in which external file systems can be temporarily mounted


Software that is theoretically optional and not vital to the running of the system (many software packages you use daily can be found here)


Virtual directory containing data about your system and its current status


The root user's personal directory


Programs essential to administration of the system


Configuration files for any network servers you might have running on your system


Mount point of the sysfs file system, which is used by the kernel to administer your system's hardware


Temporary files stored by the system


Programs and data that might be shared with other systems (such as in a large networking setup with many users)[1]


Used by the system to store data that is constantly updated, such as printer spooling output

[1]The usr directory contains its own set of directories that are full of programs and data. Many system programs, such as the X11 and KDE GUI software, are located within the /usr director. Note that the /usr directory is used even if your system will never act as a server to other systems.

The SUSE Linux file system broadly follows the principles laid down in the Filesystem Hierarchy Standard, as with most versions of Linux, but it does have its own subtleties.

image from book
Types of File Systems

Linux is all about choice, and this extends to the technology that makes the file system work. Unlike with Windows, where you can choose between just NTFS and FAT32 (with the emphasis being on NTFS), Linux offers many different types of file system technology. Each is designed for varying tasks. Most are scalable, however, which means that they will work just as happily on a desktop PC as on a massive cluster of computers. SUSE Linux uses the reiserfs file system. The Red Hat distribution normally offers the ext3 system. People are constantly arguing about which file system is best. The principal measuring stick is performance. Your computer spends a lot of time writing and reading files, so the faster a file system is, the faster your PC will be overall (although, in reality, the hardware is of equal importance).

It's worth noting that we're talking here about the underlying and invisible technology of the file system. In day-to-day use, the end user won't be aware of any difference between ext3, reiserfs, or another file system technology (although when things go wrong, different tools are used to attempt repairs; their selection is automated within SUSE Linux).

Here are the various types along with notes about what they offer:

  • ext2: Fast, stable, and well established, ext2 was once the most popular type of file system technology used on Linux. It's now been eclipsed by ext3.

  • ext3: An extension of ext2, ext3 allows journaling, a way of recording what's been written to disk so that a recovery can be attempted when things go wrong.

  • reiserfs: This is another journaling file system, which claims to be faster than others and also offers better security features.

  • jfs: This is a journaling file system created by IBM. It's used on industrial implementations of Unix.

  • xfs: This is a 64-bit journaling file system created by Silicon Graphics, Inc. (SGI) and used on its own version of Unix, as well as Linux.

image from book

Beginning SUSE Linux from Novice to Professional
Beginning SUSE Linux: From Novice to Professional
ISBN: 1590594584
EAN: 2147483647
Year: 2005
Pages: 293
Authors: Keir Thomas

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: