File system on red hat linux

Chapter 2. File System Structure and Maintenance

The file system structure is the most basic level of organization in an operating system. The way an operating system interacts with its users, applications, and security model nearly always depends on how the operating system organizes files on storage devices. Providing a common file system structure ensures users and programs can access and write 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.

Categorizing files in this manner helps correlate the function of each file with the permissions assigned to the directories which hold them. How the operating system and its users interact with a file determines the directory in which it is placed, whether that directory is mounted with read-only or read and write permissions, and the level of access each user has to that file. The top level of this organization is crucial; access to the underlying directories can be restricted, otherwise security problems could arise if, from the top level down, access rules do not adhere to a rigid structure.

2.1. Overview of Filesystem Hierarchy Standard (FHS)

Red Hat Enterprise Linux uses the Filesystem Hierarchy Standard (FHS) file system structure, which defines the names, locations, and permissions for many file types and directories.

Читайте также:  Linux command line basics audacity

The FHS document is the authoritative reference to any FHS-compliant file system, but the standard leaves many areas undefined or extensible. This section is an overview of the standard and a description of the parts of the file system not covered by the standard.

The ability to mount a /usr/ partition as read-only. This is crucial, since /usr/ contains common executables and should not be changed by users. In addition, since /usr/ is mounted as read-only, it should be mountable from the CD-ROM drive or from another machine via a read-only NFS mount.

2.1.1. FHS Organization

The directories and files noted here are a small subset of those specified by the FHS document. For the most complete information, see the latest FHS documentation at http://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf; the file-hierarchy (7) man page also provides an overview.

The directories that are available depend on what is installed on any given system. The following lists are only an example of what may be found.

2.1.1.1. Gathering File System Information

df Command

Example 2.1. df Command Output

Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 11675568 6272120 4810348 57% / /dev/sda1 100691 9281 86211 10% /boot none 322856 0 322856 0% /dev/shm

By default, df shows the partition size in 1 kilobyte blocks and the amount of used and available disk space in kilobytes. To view the information in megabytes and gigabytes, use the command df -h . The -h argument stands for «human-readable» format. The output for df -h looks similar to the following:

Example 2.2. df -h Command Output

Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 12G 6.0G 4.6G 57% / /dev/sda1 99M 9.1M 85M 10% /boot none 316M 0 316M 0% /dev/shm

In the given examples, the mounted partition /dev/shm represents the system’s virtual memory file system.

Читайте также:  How to create file and directory in linux
du Command

The du command displays the estimated amount of space being used by files in a directory, displaying the disk usage of each subdirectory. The last line in the output of du shows the total disk usage of the directory. To see only the total disk usage of a directory in human-readable format, use du -hs . For more options, see man du .

Gnome System Monitor

To view the system’s partitions and disk space usage in a graphical format, use the Gnome System Monitor by clicking on ApplicationsSystem ToolsSystem Monitor or using the command gnome-system-monitor . Select the File Systems tab to view the system’s partitions. The following figure illustrates the File Systems tab.

File Systems Tab in GNOME System Monitor

Figure 2.1. File Systems Tab in GNOME System Monitor

2.1.1.2. The /boot/ Directory

The /boot/ directory contains static files required to boot the system, for example, the Linux kernel. These files are essential for the system to boot properly.

2.1.1.3. The /dev/ Directory

These device nodes are essential for the system to function properly. The udevd daemon creates and removes device nodes in /dev/ as needed.

Devices in the /dev/ directory and subdirectories are defined as either character (providing only a serial stream of input and output, for example, mouse or keyboard) or block (accessible randomly, such as a hard drive or a floppy drive). If GNOME or KDE is installed, some storage devices are automatically detected when connected (such as with USB) or inserted (such as a CD or DVD drive), and a pop-up window displaying the contents appears.

Table 2.1. Examples of Common Files in the /dev Directory

Читайте также:  Дата создания файловой системы linux
File Description
/dev/hda The master device on the primary IDE channel.
/dev/hdb The slave device on the primary IDE channel.
/dev/tty0 The first virtual console.
/dev/tty1 The second virtual console.
/dev/sda The first device on the primary SCSI or SATA channel.
/dev/lp0 The first parallel port.

A 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-id/WWID , or /dev/disk/by-uuid/UUID . For more information, see Section 25.8, “Persistent Naming”.

2.1.1.4. The /etc/ Directory

The /etc/ directory is reserved for configuration files that are local to the machine. It should not contain any binaries; if there are any binaries, move them to /usr/bin/ or /usr/sbin/ .

For example, the /etc/skel/ directory stores «skeleton» user files, which are used to populate a home directory when a user is first created. Applications also store their configuration files in this directory and may reference them when executed. The /etc/exports file controls which file systems export to remote hosts.

2.1.1.5. The /mnt/ Directory

The /mnt/ directory is reserved for temporarily mounted file systems, such as NFS file system mounts. For all removable storage media, use the /media/ directory. Automatically detected removable media is mounted in the /media directory.

Источник

Оцените статью
Adblock
detector