Chapter 5. Linux Filesystem Tree Layout

Chapter 5. Linux Filesystem Tree Layout

There are many different types of files, and depending on their purpose, shareability, ownership, size and other factor, it is worthwhile to organize them with an standard structure as much as possible.

OBJECTIVES

  • Explain why Linux requires a big filesystem tree
  • Describe what must be available at boot in the root directory and what can be available once the system has started
  • Explain each of the main subdirectories of the filesystem tree in terms of purpose and content

 

/

This is the root of the filesystem

/bin

This folder contains essentials system binaries even for the kernel usage

/boot

This folder contains the bootloader and the linux kernel

This folder is essential for the system

/dev

This folder contains information about special device files (device nodes). Sample of these files are

  • eth0
  • wlan0
  • tty1, tty0, ....

These special files are essential for the system to function properly.

/etc

System configuration files, even so called SysVinit services within the init.d folder. Sample of these files or folders are

  • systemd
  • sudoers
  • X11
  • yum

/proc

System running processes information 

/sys

This directory is the mount point for the sysfs pseudo-filesystem where all information resides only in memory, not on disk, that is why /sys is empty in a non-running system.  The sysfs gathers information about the system and modify its behavior while it is running, this folder is essential in order to perform system monitoring.

/mnt

Mounting folder for system administrators to mount a filesystem when needed, a common use is for network filesystems, including

  • NFS
  • Samba
  • CIFS
  • AFS

/var

Folder to store variable data files, such as logs, web sites root folders, lock files and so on

/sbin

Additional binaries to the bin folder such as route fdisk and so on

/media

Mounting folder for removable devices's filesystem.

  • CD
  • DVD
  • USB
  • Floppies

/lib

Folder to store libraries essential for the binaries located at /bin and /sbin folders.

This folder is essential for the system in the booting process and executing commands within the root filesystem

/usr

Secondary filesystem to save local system information, non essential for the system boot process

/home

Folder to keep user and/or groups data

/opt

Folder to store program data in a single place

/root

Root's (user) home folder

/run

Folder to keep transient data, those that contain run-time information which may need to be written early in system startup and do not need to be preserved when rebooting

/tmp

Folder to store temporal files
 

LAB 5.1

Sizes of the default linux directories

$ du --help

[root@localhost etc]# du --max-depth=1 -hx /

1,9G    /var
52K     /root
4,0K    /media
4,0K    /srv
3,7G    /usr
31M     /etc
16K     /lost+found
4,0K    /mnt
41M     /home
4,0K    /opt
5,6G    /

​/dev, /proc, /run, /sys are not listed here since they are pseudo filesystems, data that only lives on memory (-x parameter allow us to list only the file on the / partition)

Also /bin, /sbin, /lib and /lib64 are not listed since in RHEL such folders are symbolic links to their conterpart in /usr

 

LAB 5.2

Touring the /proc Filesystem

​$ cd /proc

​This folder has information about the running process within the system