Certification Objective 2.01: Disk Partitions and Block Devices

 < Day Day Up > 

A disk drive requires a partition table. The partition is a logical sequence of cylinders on the disk, while a cylinder represents all the sectors that can be read by all heads with one movement of the arm that contains all these heads. While it's possible to create more, RHEL 3 will recognize only up to 16 partitions on any individual SCSI or an IDE hard drive. But don't be too concerned about these details; I think it's highly unlikely that you'll have to create so many partitions on either exam.

On The Job 

The main Linux partition utility is fdisk. As you'll see in Chapter 3, it won't allow you to create more than 16 partitions on each physical hard disk.

Normally, you should create several partitions when preparing your hard drive to install Linux. This is a good idea for various reasons. First, RHEL 3 is normally configured with at least two filesystems: a Linux native filesystem and a Linux swap filesystem. Second, if you want to install RHEL 3 and another operating system on the same computer, you will have to configure separate partitions for each operating system. You can configure software RAID partitions on different hard drives during the RHEL 3 installation process. However, if you have a hardware RAID system, you'll need to configure it after RHEL 3 is installed.

Exam Watch 

During the Installation and Configuration exam, pay careful attention to the instructions. Make sure that the partitions you create while installing RHEL match any instructions you might see. It's much more difficult and much more time-consuming to revise partitions with utilities such as fdisk after RHEL is installed.

Naming Conventions

Linux has a simple naming standard for disk partitions: three letters followed by a number. The first letter identifies the type of drive (h is for IDE/EIDE, s is for SCSI). The second letter is d for disk, and the third letter represents the relative position of that disk, starting with 'a.' In other words, the first IDE drive is hda, followed by hdb, hdc, and hdd.

The number that follows is based on the relative position of the partition. There are primary, extended, and logical partitions. Primary partitions can contain the boot files for an operating system. Hard drives can also be configured with one extended partition, which can then contain up to 12 logical partitions.

You are limited to four primary partitions on each hard disk. But four partitions are often not enough. If you need more partitions on an IDE drive, substitute an extended partition for one primary partition. You can then configure the logical partitions that you need within the extended partition.

You can't install files directly in an extended partition. You must first allocate some extended partition space to at least one logical partition. You can then configure up to 11 logical partitions within that extended partition. In all cases, the first logical partition on the first IDE drive is hda5.

On The Job 

While you can actually configure more than 11 logical partitions in an IDE extended partition, that's as many as RHEL 3 will accept.

Each partition is associated with a Linux device file. At least this is straightforward; for example, the device filename associated with the first logical partition on the first IDE drive is /dev/hda5.

Exam Watch 

You should know the device name associated with each partition, as well as the starting names and numbers of any logical partitions created on any basic disk drive. Also remember that logical partitions on an IDE hard drive always start with number 5; on the first IDE hard drive on a PC, that is hda5.

Exercise 2-1: Partitioning

start example

You may never have had to plan partitions on a basic Microsoft Windows desktop computer. On a real server, whether you're using Windows or Linux, you should preplan your disk usage and partitions very carefully. This is a preliminary exercise; be prepared to think more deeply about partitions later in this chapter and in Chapter 3.

  1. On a piece of paper, draw a rectangle to represent each hard drive on your computer.

  2. Label them in order just as Linux would (Hard Drive 1: /dev/hda, Hard Drive 2: /dev/sda, Hard Drive 3: /dev/sdb).

  3. Use this diagram to plan how you are going to partition each drive. While this is a preview of future chapters, you should already know that Linux is set up in multiple directories. Each of these directories can be set up in its own partition. Think about how much space you want to allocate to several major directories, such as /home, /var, /usr, /boot. Don't forget to allocate some area for a swap partition.

end example

Using this method, you can organize your data, keeping system or users' files together, as well as strategically plan where to place your swap partition(s).

Stability and Security

Linux is organized in a Filesystem Hierarchy Standard (FHS) which includes a number of directories described in Chapter 1. You can organize these directories into a few or many hard drive partitions. During the installation process, RHEL is by default organized into three partitions: the root directory, /, the /boot directory, and a swap partition. One recommended configuration for a Linux server includes separate partitions for each of the following directories: /, /boot, /usr, /tmp, /var, and /home. Other partitions may be appropriate for corporate data, database services, and even the Web and FTP sites if they are expected to be large.

Partitioning the hard drive in this manner keeps system, application, and user files isolated from each other. This helps protect the disk space used by the Linux kernel and various applications. Files cannot grow across partitions. For example, an application such as a Web server that uses huge amounts of disk space can't crowd out space needed by the Linux kernel. Another advantage is that if a bad spot develops on the hard drive, the risk to your data is reduced, as is recovery time. Stability is improved.

Security is also improved. Multiple partitions give you the ability to set up certain directories as read-only filesystems. For example, if there is no reason for any user (including root) to write to the /usr directory, mounting that partition as read-only will help protect those files from tampering.

While there are many advantages to creating many disk partitions, it isn't always the best solution. When hard drive space is limited, the number of partitions should be kept to a minimum. For example, if you have a 2GB hard drive and want to install 1500MB during RHEL installation, you may not want to dedicate extra space to the /var directory. You need room for swap space, additional programs, and your own personal files on other directories.

On The Job 

If you think you may need to reconfigure your Linux partitions in the future, learn more about Logical Volume Management (LVM) configuration. It can allow you to resize Linux partitions after installation.

Exam Watch 

It can take considerable time to set up LVM partitions. Unless you know the process very well, the fastest way is through the RHEL installation program in graphical mode, which is available when installing from CD or from an NFS server. (LVM configuration is not available via text mode RHEL installation.) Learn the process well, just in case you need to set up LVM during the Installation part of the exam.

Basic Space Requirements

Linux is a very flexible operating system. While a full installation of RHEL 3 requires several gigabytes of space, the Red Hat 1.44MB rescue disk that you can create during installation is also a complete operating system (in a minimalist fashion). Depending on your needs, you can install RHEL comfortably, without the GUI, on any hard drive larger than 1GB.

In Chapter 3, you'll learn about the different ways you can allocate space on partitions to several different Linux directories.

On The Job 

There is a Linux distribution on CD which can even be used to diagnose hard disk failures on Microsoft Windows PCs. For more information, see www.knoppix.net. But you won't be able to use the Knoppix CD on the Red Hat exams.

You should size your Linux partitions according to your needs and the function of the computer. For example, a mail server will require more space in /var, because mail files are stored in /var/spool/mail. You could create a separate partition for /var or even /var/spool/mail. In almost every case, it's a good idea to configure at least the /boot directory on a separate partition.

Example: File Server

If the Linux system you are installing is to be a file server, then you could configure your partitions as shown in Table 2-1.

Table 2-1: Example Partition Configuration for a Linux File Server


Size (MB)

Mounted Directory















Swap space







The /usr filesystem is large enough to include key services such as Samba and the Linux graphical user interface. Most of the disk space has been allocated to /var, for the log files and for FTP and Web services, to /home for individual user files, and to /home/shared for common files. Of course, this is only an example. The amount of disk space you allocate for file sharing will depend on factors such as the number of users and the type of files they work on.

Linux Swap Space

Linux uses the swap space configured on one or more hard drive partitions to store infrequently used programs and data. Swap space can extend the amount of effective RAM on your system. However, if you don't have enough actual RAM, Linux may use the swap space on your hard drive as virtual memory for currently running programs. Because hard drive access can be 1/100,000th the speed of RAM, this can cause significant performance problems.

But you can't just buy extra RAM and eliminate swap space. Linux moves infrequently used programs and data to swap space even if you have gigabytes of RAM.

Normally, Linux (on a 32-bit Intel-style computer) can use a maximum 4GB of swap space, in partitions no larger than 2GB. This 4GB can be spread over a maximum of eight partitions. The typical rule of thumb suggests that swap space should be two to three times the amount of RAM. However, at larger amounts of RAM, the amount of swap space that you need is debatable.

The way Red Hat assigns default swap space is based on the amount of RAM on your system and the space available in your hard drive. As discussed in Chapter 1, Red Hat requires at least 256MB of RAM on RHEL 3. If there's room available on your hard drives, Anaconda configures a swap partition of at least 512MB. For Intel 32-bit systems, Red Hat requires a swap partition at least equal to the amount of RAM on your system.

On The Job 

Red Hat RAM and swap space requirements vary if you're installing RHEL 3 on computers with non-Intel 32-bit CPUs.

In any case, you want to make the swap space you create as efficient as possible. Swap partitions near the front of a hard disk, thus on a primary partition, have faster access times. Swap partitions on different hard drives attached to separate disk controllers gives Linux flexibility on where to send swap data. Linux can start a program through one hard drive controller, and move files to and from swap space on a separate hard drive controller simultaneously.

BIOS Limits

Some computers built before 1998 may have a BIOS that limits access to hard disks beyond the 1,024th cylinder. Some older BIOSes report only 1,024 cylinders on a hard drive no matter how many actual cylinders there are. Computers that are subject to this limit can't see partitions beyond this cylinder. In this case, you should configure the Linux /boot directory on its own partition. Make sure that partition is located within the first 1,024 cylinders of the hard drive. Otherwise, the BIOS won't be able to find the partition with the Linux kernel.

Exam Watch 

Problems due to hardware limitations are common and difficult to troubleshoot if you don't know about them. Familiarize yourself with as many hardware limitations as you can, including the 1,024-cylinder limit inherent in some older PC models. But don't overdo it; the Red Hat exams are focused on Linux, not PC hardware.

Logical Block Addressing (LBA)

Most PCs manufactured after 1998 have a built-in fix called logical block addressing, or LBA. A system that can report LBA will adjust the cylinder, head, and sector numbers such that the entire disk is available using these logical addresses.

Multiple Controllers

It is possible and desirable to use more than one disk controller interface card at the same time on the same PC. This is a common method to increase throughput on your system by reducing your read/write bottlenecks to the only disk.

You can use both SCSI and EIDE controllers in the same machine, but you should be aware of a few snags. The BIOS may only have access to the first two EIDE hard drives. Also, SCSI disks may not be accessible if EIDE drives are installed. The BIOS might have a setting to allow you to boot from SCSI hard disks. Make sure you understand which drives the BIOS will be able to access. If you install /boot on an inaccessible drive, the BIOS won't be able to find your Linux boot files.

On The Job 

Many servers are set up with SCSI and EIDE hard drives. If you have one SCSI and two EIDE hard drives, and your computer is set up to boot Linux from a SCSI disk, the BIOS assigns the number 0x80 to /dev/sda (the SCSI disk) and 0x81 to /dev/hda (the first EIDE drive). Linux, however, assigns 0x80 to /dev/hda, 0x81 to /dev/hdb (the second EIDE disk), and 0x82 to the SCSI disk. There is a disagreement between the BIOS and the boot loader. Your boot loader (GRUB or LILO) will not find the boot sector on /dev/sda and, therefore, will not be able to boot Linux.

Partitioning Utilities

Many disk-partitioning utilities are available for Linux-even utilities that do not run under Linux. The basic Linux partitioning utility is fdisk. During installation, Red Hat gives you access to Disk Druid. They all work toward the same end, but Red Hat recommends you use Disk Druid during the installation. It is safer than fdisk, and it has an easier-to-read graphical interface. But Disk Druid is not available after RHEL is installed.

On The Job 

As it's not cited in any of the Red Hat requirements for the exams, I do not cover the parted utility. However, it is a viable option for managing your partitions.

 < Day Day Up > 

RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
ISBN: 71765654
Year: 2003
Pages: 194

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