Understanding the Filesystem Hierarchy Standard

When you install Linux, you can mount all of the Linux directories on a single partition. Alternatively, you can set up just about any Linux directory as a distinct filesystem by mounting it in a separate partition.

Establishing separate partitions limits risks to your system. For example, web servers such as Apache can accumulate log files that can consume gigabytes of space, easily crowding out all free space on your hard drive. Your users would no longer be able to save files, there would be no room for Linux to prepare print jobs, and chaos would undoubtedly result.

However, if you mount the right directory in a separate partition, your users can still work and save files even if the partition with the log files becomes full.

The Basic Linux Directory Structure

Before you select partitions for your Linux system, you first need to be familiar with the options in Linux directories. Red Hat Linux organizes files into directories according to the Filesystem Hierarchy Standard (FHS):

/ The top-level root directory. All other directories are below the root directory in the filesystem hierarchy. In other words, they are subdirectories . Any directory not mounted in a separate partition is automatically part of the root directory volume.

/bin Contains basic command-line utilities. You should not configure this directory in a separate partition. If you do, you won t be able to access these utilities in linux rescue mode.

/boot Includes the commands and files required for Linux to boot on your computer, such as the Grand Unified Bootloader (GRUB), the Initial RAM disk, and the Linux kernel. If you have a larger drive (over 8GB), it is generally a good idea to mount /boot in a separate partition. This helps to ensure that your Linux boot files remain accessible when you start your computer.

/dev Lists available device drivers. For example, if you mount a floppy drive, you might mount /dev/fd0 onto a directory such as /mnt/floppy . You should not mount this directory in a separate partition.

/etc Contains basic Linux configuration files, including those related to passwords, daemons such as Apache and Samba, and the X Window.

/home Includes home directories for all but the root user . If you mount this directory in a separate partition, leave enough room for each of your users to add files.

/initrd Configures an empty directory used by the Initial RAM disk during the boot process. Do not mount this directory in a separate partition. If you delete this directory, Red Hat Linux will not boot; you ll get a kernel panic message. This directory is not a formal part of the FHS.

/lib Lists program libraries needed by a number of different applications as well as the Linux kernel. You should not mount this directory in a separate partition.

/lost+found Contains orphan files. Utilities such as fsck place empty unidentifiable files (or parts of files) in this directory. This directory is not a formal part of the FHS.

/misc Notes a common mount point for shared NFS directories. This directory is not a formal part of the FHS.

/mnt Contains the mount point of removable media, such as floppy ( /mnt/floppy ), CD-ROM ( /mnt/ cdrom ), and Zip ( /mnt/zip ) drives .

/opt Includes the standard locations for third-party applications such as Sun StarOffice or Corel WordPerfect.

/proc Includes all kernel-related processes that are currently running. Some of the files in this directory list current resource allocations ; for example, /proc/interrupts lists currently allocated interrupt request (IRQ) ports.

/root The home directory for the root user. The /root directory is a subdirectory of the root ( / ) directory. Do not mount this directory separately.

/sbin Contains many system administration commands. Do not mount this directory separately.

/tftpboot Supports diskless workstations, also known as remote terminals. The diskless workstation mounts this directory from the Linux terminal server. This directory is not a formal part of the FHS.

/tmp Serves as a dedicated storage location for temporary files; also a good place to download files. By default, the /etc/cron.daily/ tmpwatch script empties files older than 10 days from this directory.

/usr Includes programs and data available to all users; contains many subdirectories. For example, the programs associated with the OpenOffice suite are installed in /usr/bin .

/var Contains variable data, including log files and print spools. On Linux servers, this directory is frequently mounted on a separate partition.

Note  

The top-level root directory, / , is different from the home directory of the root user, /root . In fact, /root is a subdirectory of / .

You ll want to mount some of these directories on separate hard drive partitions. For example, by mounting /home on a separate partition, you ensure that this directory will always have access to the space on that partition. In addition, by mounting /var on a separate partition, you can keep runaway log files from crowding out space needed by files in other directories. In the sections that follow, we discuss this approach in greater depth.

Partition Schemes

You now know that Linux provides a variety of ways to set up partitions. To help guide your efforts, there are a few standard partition schemes. By default, when you install Red Hat Linux, you will set up at least two directories on separate partitions: the root ( / ) directory and /boot . The /boot directory is commonly mounted on its own partition because many Linux installations cannot start if the files in the /boot directory are stored above hard drive cylinder 1024.

Note  

For most newer computers, configuring the /boot directory above cylinder 1024 can work with LBA enabled; see Chapter 03 , for more information. (LBA stands for Logical Block addressing, which is the way a BIOS looks at the cylinders , heads, and sectors of a hard drive.)

When you install Red Hat Linux in the Server configuration, the default includes several more mounted directories: /home , /usr , and /var . Other configurations may be appropriate if you re installing different Linux directories on different physical hard drives. Table 7.1 contains a short list of possible Linux partition configurations.

Table 7.1: Possible Linux Partition Configurations

Mounted Directories

Comment

/ , swap

Typical configuration for a computer with one small hard drive.

/ , /boot , swap

Typical configuration for a computer with a large hard drive. This is the default configuration for the Red Hat Linux 9 Personal Desktop and Workstation installation.

/ , /boot , /var , swap

Possible configuration where log file size , such as from a web server, is an issue. This can prevent runaway log files from crowding out all free space on your Linux computer.

/ , /boot , /home , swap

Possible configuration for a Linux server with home directories for a number of other users. With other measures such as quotas, this can help regulate the amount of space taken by individual users.

 


Mastering Red Hat Linux 9
Building Tablet PC Applications (Pro-Developer)
ISBN: 078214179X
EAN: 2147483647
Year: 2005
Pages: 220

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net