CentOS-7 Filesystem Hierarchy Standard

File systems break files down into two logical categories:


 I . Shareable vs. unsharable files

 II. Variable vs. static files




Shareable files can be accessed locally and by remote hosts; unsharable files are only available locally. Variable files, such as documents, can be changed at any time; static files, such as binaries, do not change without an action from the system administrator.





1. / : Primary hierarchy of root and root directory of the entire file system hierarchy.



2. /boot: The /boot/ directory contains static files required to boot the system. Ex- the Linux kernel, initrd, vmlinuz.



3. /dev: The /dev/ directory contains device nodes that represent the following device types:

                devices attached to the system,
                virtual devices provided by the kernel.
The udevd daemon creates and removes device nodes in /dev/ as needed. Devices in the /dev/directory and subdirectories are defined as either character or block. If GNOME or KDE is installed, some storage devices are automatically detected when connected (such as USB) or inserted (such as a CD or DVD drive),a pop-up window displaying the contents appears.


A valid block device can be one of two type of entries:



A mapped device: A logical volume in a volume group, for example, /dev/mapper/VolGroup00-LogVol02.



A static deviceA traditional storage volume, for example, /dev/sdbX, where sdb is a storage device name and X is the partition number./dev/sdbX can also be /dev/disk/by-i d /WWID, or /dev/disk/by-uuid/UUID.



4. /etc: This directory contains the configuration files for RPMS. EX- 

            /etc/samba/ directory contains configuration files for samba.
            /etc/pki/ directory contains gpg key file for repositories.
            /etc/exports file controls which file systems export to remote hosts.


5. /home: The /home directory contains every users home directories except root.



6. /media: Automatically detected removable media will be mounted in the /media directory.



7. /mnt: The /mnt/ directory is reserved for temporarily mounted file systems, such as NFS file system mounts, ISO file mounts.



8. /opt: This directory is reserved for third party software and add-on packages that are not part of the default installation. A package that installs to /opt/ creates a directory bearing its name, for example, /opt/packagename/. In most cases, such packages follow a predictable subdirectory structure; most store their binaries in /opt/packagename/bin/ and their man pages in /opt/packagename/man/.



9. /proc: The /proc/ directory contains special files that either extract information from the kernel or send information to it. Examples of such information include system memory, CPU information, and hardware configuration.



           /proc contains neither text nor binary files. It contains virtual files;as such, /proc is normally referred to as a virtual file system. These virtual files are typically zero bytes in size, even if they contain a large amount of information.The /proc file system is not used for storage. Its main purpose is to provide a file-based interface to hardware, memory, running processes, and other system components. Real-time information can be retrieved on many

system components by viewing the corresponding /proc file. Some of the files within /proc can also be manipulated (by both users and applications) to configure the kernel.The following /proc files are relevant in managing and monitoring system storage:


/proc/devices Displays various character and block devices that are currently configured.

/proc/filesystems Lists all file system types currently supported by the kernel.
/proc/cpuinfo Contains information of processors .
/proc/mounts Lists all mounts currently used by the system.
/proc/partitions Contains partition block allocation information.


10. /root : This directory is root/Admin home directory.



11. /run : Run-time variable data. Information about the system running since last boot. 

            Ex- Currently login users and running daemons. 


12. /srv: The /srv/ directory contains site-specific data served by a Red Hat Enterprise Linux system. This directory gives users the location of data files for a particular service, such as FTP, WWW, or CVS. Data that only pertains to a specific user should go in the /home/ directory.



13. /sys: The /sys directory utilizes the new sysfs virtual file system specific to the kernel. With the increased support for hot plug hardware devices in the kernel, the /sys/ directory contains information similar to that held by /proc/, but displays a hierarchical view of device information specific to hot plug devices.



14. /tmp/: Temporary files (see also  /var/tmp). Often not preserved between system reboots.



15. /usr: The /usr/ directory is for files that can be shared across multiple machines. At a minimum, /usr/ should contain the following subdirectories:

/usr/bin This directory is used for binaries.
/usr/etc This directory is used for system-wide configuration files.
/usr/games This directory stores games.
/usr/include This directory is used for C header files.
/usr/kerberos This directory is used for Kerberos-related binaries and files.
/usr/lib This directory is used for object files and libraries that are not designed to be directly utilized by shell scripts or users. CentOS 7.0, the /lib/ directory has been merged with /usr/lib. It now also contains libraries needed to execute the binaries in /usr/bin/ and /usr/sbin/. These shared library images are used to boot the system or execute commands within the root file system.
/usr/libexec This directory contains small helper programs called by other programs.
/usr/sbin As of CentOS 7.0, /sbin has been moved to /usr/sbin. This means that it contains all system administration binaries, including those essential for booting, restoring, recovering, or repairing the system. The binaries in /usr/sbin require root pivileges to use.


/usr/share This directory stores files that are not architecture-specific.

/usr/src This directory stores source code. Ex- the kernel source code with its header files
/usr/tmp linked to /var/tmp This directory stores temporary files.


The /usr/ directory should also contain a /local/subdirectory. As per the FHS, this subdirectory

is used by the system administrator when installing software locally, and should be safe from 
being overwritten during system updates. The /usr/local directory has a structure similar to 
/usr/, and contains the following subdirectories:
/usr/local/bin
/usr/local/etc
/usr/local/games
/usr/local/include
/usr/local/lib
/usr/local/libexec
/usr/local/sbin
/usr/local/share
/usr/local/src


16./var: Since the FHS requires Linux to mount /usr/ as read-only, any programs that write log files or need spool/ or lock/ directories should write them to the /var/ directory. The FHS states /var/ is for variable data, which includes spool directories and files, logging data, transient and temporary files.System log files, such as messages and lastlog , go in the /var/log/ directory. Most files pertaining to RPM are kept in the /var/lib/rpm/ directory. For more information on RPM, refer to man rpm. The /var/cache/yum/ directory contains files used by the Package Updater, including RPM header information for the system. This location may also be used to temporarily store RPMs downloaded while updating the system. Lock files go in the /var/lock/ directory, usually in directories for the program using the file. The /var/spool/ directory has subdirectories that store data files for some programs. These subdirectories include:

/var/spool/at/
/var/spool/clientmqueue/
/var/spool/cr n/
/var/spool/cups/
/var/spool /exi m/
/var/spool/lpd /
/var/spool/mail/

No comments:

Post a Comment