Previous Page
Next Page

4.1. Objective 1: Design a Hard Disk Layout

Part of the installation process for Linux is the design of the hard disk partitioning scheme. If you're used to systems that reside on a single partition, this step may seem to complicate the installation. However, there are advantages to splitting the filesystem into multiple partitions and even onto multiple disks.

You can find more details about disks, partitions, and Linux filesystem top-level directories in Chapter 6. This Topic covers considerations for implementing Linux disk layouts.

4.1.1. System Considerations

A variety of factors influence the choice of a disk layout plan for Linux, including:

  • The amount of disk space

  • The size of the system

  • What the system will be used for

  • How and where backups will be performed

4.1.1.1. Limited disk space

Except for read-only filesystems (such as CD-ROMs or a shared /usr partition), most Linux filesystems should have some free space available. Filesystems holding user data should be maintained with a maximum amount of free space to accommodate user activity. When considering the physical amount of disk space available, you may be forced to make a trade-off between the number of filesystems in use and the availability of free disk space. Finding the right configuration depends on system requirements and available disk resources.

When disk space is limited, you may opt to reduce the number of filesystems, thereby combining free space into a single contiguous pool. For example, installing Linux on a PC with only 1 GB of available disk space might best be implemented using only a few partitions:


/boot

50 MB. A small /boot filesystem in the first partition ensures that all kernels are below the 1024-cylinder limit.


/

850 MB. A large root partition holds everything on the system that's not in /boot.


swap

100 MB.

The /boot partition could be combined with the root partition as long as the entire root partition fits within the 1024-cylinder limit (see Chapter 3).

4.1.1.2. Larger systems

On larger platforms, functional issues such as backup strategies and required filesystem sizes can dictate disk layout. For example, suppose a file server is to be constructed serving 100 GB of executable data files to end users via NFS. Such a system will need enough resources to compartmentalize various parts of the directory tree into separate filesystems and might look like this:


/boot

100 MB. Keep kernels under the 1024-cylinder limit.


swap

1 GB.


/

500 MB (minimum).


/usr

4 GB. All of the executables in /usr are shared to workstations via read-only NFS.


/var

2 GB. Since log files are in their own partition, they won't threaten system stability if the filesystem is full.


/tmp

500 MB. Since temporary files are in their own partition, they won't threaten system stability if the filesystem is full.


/home

90 GB. This is the big filesystem, offered to users for their home directories.

On production servers, much of the system is often placed on redundant media, such as mirrored disks. Large filesystems, such as /home, may be stored on some form of disk array using a hardware controller.

4.1.1.3. System role

The role of the system also can dictate disk layout. In a traditional Unix-style network with NFS file servers, most of the workstations won't necessarily need all of their own executable files . In the days when disk space was at a premium, this represented a significant savings in disk space. While space on workstation disks isn't the problem it once was, keeping executables on a server still eliminates the administrative headache of distributing updates to workstations.

4.1.1.4. Backup

Some backup schemes use disk partitions as the basic unit of system backup. In such a scenario, each of the filesystems listed in /etc/fstab is backed up separately, and they are arranged so that each filesystem fits within the size of the backup media. For this reason, the available backup device capabilities can play a role in determining the ultimate size of partitions.

4.1.2. Swap Space

When you install Linux, you're asked to configure a swap, or virtual memory, partition. This special disk space is used to temporarily store portions of main memory containing programs or program data that is not needed constantly, allowing more processes to execute concurrently. An old rule of thumb for Linux is to set the size of the system's swap space to be double the amount of physical RAM in the machine. For example, if your system has 512 MB of RAM, it would be reasonable to set your swap size to at least 1 GB. These are just guidelines of course. A system's utilization of virtual memory depends on what the system does and the number and size of processes it runs. As hard disk and memory gets cheaper and Linux application footprints grow, the guidelines for determining swap sizes become more and more about personal preference. However, when in doubt, using twice the amount of main memory is a good starting point.

4.1.3. General Guidelines

Here are some guidelines for partitioning a Linux system:

  • Keep the root filesystem (/) simple by distributing larger portions of the directory tree to other partitions. A simplified root filesystem is less likely to be corrupted.

  • Separate a small /boot partition below cylinder 1024 for installed kernels used by the system boot loader.

  • Separate /var. Make certain it is big enough to handle your logs and their rotation scheme.

  • Separate /tmp. Its size depends on the demands of the applications you run. It should be large enough to handle temporary files for all of your users simultaneously.

  • Separate /usr and make it big enough to accommodate kernel building. Making it standalone allows you to share it read-only via NFS.

  • Separate /home for machines with multiple users or any machine where you don't want to affect data during distribution software upgrades. For even better performance (for multi-user environments) put /home on a disk array.

  • Set swap space to at least the same size (double preferred) as the main memory.

On the Exam

Since a disk layout is the product of both system requirements and available resources, no single example can represent the best configuration. Factors to remember include placing the kernel below cylinder 1024, effectively utilizing multiple disks, sizing partitions to hold various directories such as /var and /usr, and the importance of the root filesystem and swap space size.



Previous Page
Next Page