Certification Objective 2.06-Configuring Partitions, RAID, and LVM


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. Although it's possible to create more, RHEL will recognize only up to 16 partitions on any individual SATA/SCSI or an ATA/IDE hard drive. But don't be too concerned about these details; you probably won't have to create so many partitions on either exam.

Once you create a partition, you can mount a directory directly on that partition. Alternatively, you can designate that partition as a RAID device or as part of a logical volume. Both systems are described briefly in this chapter; for more information, see Chapter 8.

On the Job 

The main Linux partition utilities are fdisk and parted. As you'll see in Chapter 4, although you can create more than 16 partitions on each physical hard disk, you'll find that you can't write more than 16 partitions on each hard disk.

RAID, Briefly

RAID is short for a Redundant Array of Independent (or Inexpensive) Devices, and it can help you create a filesystem on more than one partition, with or without redundancy. Red Hat supports the software version of this scheme at four different levels.

  • RAID 0 stripes a filesystem across multiple partitions for faster reads and writes.

  • RAID 1 mirrors all data in a filesystem between two partitions.

  • RAID 5 uses parity bits (striping) for data redundancy over three or more partitions.

  • RAID 6 uses double parity bits (striping) for data redundancy over four or more partitions.

To take full advantage of RAID, you'll want to configure partitions on different physical hard drives, preferably connected to different hard drive controllers. That maximizes the ability to read and write to a RAID filesystem, and it means (except for RAID 0) that your data will not be lost if one hard drive fails. But multiple hard drives may not be available on the computer you use to take an exam. (For more information on RAID and how you can manage it after installation, see Chapter 8.)

Logical Volumes, Briefly

Logical volumes give you flexibility with your filesystems. You can expand and contract the space associated with different directories. If you need more space, say for the /home directory, you can add a new hard drive, partition it as a logical volume, and use it to add more space to the /home directory.

The Red Hat installation process, by default, configures all but the /boot directory as part of a logical volume, with the configuration described in Table 2-1. Chances are good that won't match the requirements on your RHCE or RHCT installation exam. We'll explore how you can customize it shortly.

Table 2-1: Result When You Partition Automatically

Location

Size

/boot

100MB

Swap

Twice available RAM (assuming sufficient hard drive space)

/

Remaining space on the drive, mounted on a Logical Volume Group

It's faster and easier to configure LVM during the installation process. While Red Hat provides the Logical Volume Management GUI tool, it takes time to use it. It may be faster to use regular command line-based commands to reconfigure LVM. But requirements change and mistakes are made, during the installation process and in real life. So for more information on logical volumes and how you can manage them after installation, see Chapter 8.

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 SATA or 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 ATA/IDE drive is hda, followed by hdb, hdc, and hdd.

The number that follows is based on the relative position of the primary, extended, or logical partition. 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 a hard 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 logical partitions within that extended partition. In all cases, the first logical partition on the first PATA/IDE drive is hda5.

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 PATA/IDE drive is /dev/hda5.

image from book
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 a hard drive always start with number 5; on the first PATA/IDE hard drive on a PC, that is hda5.

image from book

Exercise 2-1: Partitioning

image from book

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 4.

  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.

image from book

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). Now in the second exercise, let's examine how you can create and configure partitions during the installation process. We'll also examine how you can allocate a filesystem to a partition, a logical volume, or a RAID array.

Exercise 2-2: Partitioning During Installation

image from book

To follow along in this chapter, you presumably are installing RHEL 5 on some system. It's easiest if you practice using a virtual machine based on VMware or Xen. If you make a mistake, you can restart the installation process and return to these partitioning steps. This exercise starts with Figure 2-8, which is the first partitioning step, and assumes you're testing with the graphical installation.

image from book
Figure 2-8: Basic partitioning

The Advanced Storage Configuration option is associated with network connections using the TCP/IP iSCSI network protocol. As this option is not part of the Red Hat Exam Prep guide, we won't cover it here. For more information, start with the Linux-iSCSI project, described at http://linux-iscsi.sourceforge.net.

  1. Click the top drop-down text box, and you'll see four options. In the following steps, you'll examine each option in turn with the associated default partitioning layout.

  2. Check the Review And Modify Partitioning Layout checkbox near the bottom of the window.

  3. Select Remove All Partitions On Selected Drives And Create Default Layout, and click Next.

  4. If more than one drive is available, deselect drives where you want to save the data.

  5. If you see the warning about removing partitions from specified drives, click Yes to continue.

  6. Review the default partitioning layout, and click Back to return.

  7. Select Remove Linux Partitions On Selected Drives And Create Default Layout, and click Next to continue. Repeat steps 4 to 6.

  8. Select Use Free Space On Selected Drives And Create Default Layout, and click Next to continue. Repeat steps 4 to 6.

  9. Select Create Custom Layout, and click Next to continue.

  10. Start creating your own custom layout. If you're starting with blank hard disks, no partitions will be configured. Delete configured partitions if no space is available.

  11. Try creating a regular partition. Click New. Create an appropriate mount point, such as /home/user. Click the File System Type drop-down text box and review the available formats.

  12. Create one partition with an unused filesystem type, and click OK to continue.

  13. Repeat steps 11 and 12. For the purpose of this exercise, the default 100MB is sufficient.

  14. Create five RAID partitions. Click RAID; this opens the RAID Options window. If you don't have any other RAID partitions, only one of the three options can be selected: Create A Software RAID Partition. Click OK; this opens the Add Partition window, with a Software RAID File System Type. Create a partition of the desired size (100MB is OK for this exercise) and click OK. Repeat this process three times, making sure to select Create A Software RAID Partition each time.

  15. You should now have five RAID partitions. Click RAID, and in the RAID Options window, select Create A RAID Device. Click OK to open the Make RAID Device window.

  16. Create an appropriate mount point such as /home/raidtest. Check available filesystem types; you'll see the same format options you saw in step 11.

  17. The RAID Device drop-down text box is trivial; it just specifies the device file associated with the RAID array you're about to create.

  18. Click the RAID Level drop-down text box. You'll see that you can configure four different types of RAID arrays: RAID0, RAID1, RAID5, and RAID6. (For more information on each level, see Chapter 8.) Select RAID6.

  19. Enter 1 in Number of Spares, and click OK. This works because RAID 6 requires a minimum of four RAID partitions and as many spares as available. Review the resulting RAID device. How much space is available in the device? How does that compare to the space used by the five different RAID partitions?

  20. Now click New again, and create a partition of the Physical Volume (LVM) filesystem type. Repeat the process to create a second LVM partition.

  21. Click LVM. This opens the Make LVM Volume Group window. Review the available options.

  22. In the Make LVM Volume Group window, click the Physical Extent drop-down text box. Review the available Physical Extents, which are units associated with volume groups.

  23. Make sure all available Physical Volumes To Choose are active.

  24. Click Add; this opens the Make Logical Volume window.

  25. Create an appropriate mount point such as /home/volume. Note that the available filesystem types are more limited. The Logical Volume Name shown is just the default; you can use any legal filename for your logical volume. Set a size that does not use all available space. Click OK.

  26. Review the result in the Make LVM Volume Group window. Click OK and review the result in the original partition window.

  27. Changes are not permanent; you should be able to click Back a couple of times and return to restore the original partition configuration.

image from book

Separate Filesystems

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

image from book
Exam Watch

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

image from book

Stability and Security

Linux is organized in a Filesystem Hierarchy Standard (FHS) that 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 directories associated with Web (/var/www/html) and FTP (/var/ftp/pub) sites if you need them to hold a lot of data.

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 more 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 4GB hard drive and want to install 3000MB of packages 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.

image from book
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/DVD or over a network 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 and Configuration part of your exam.

image from book

Basic Storage Space Requirements

Linux is a flexible operating system. While a full installation of RHEL requires several gigabytes of space, slightly older versions of Linux fit even on a 1.44MB floppy disk. Depending on your needs, you can install RHEL, with a couple of services, without the GUI, on any hard drive larger than 2GB.

On the Job 

There are also complete Linux distributions that you can boot and load directly from a CD or DVD, which can be used to diagnose hard disk failures on Microsoft Windows PCs. For more information, see www.knoppix.net. Even Fedora Core now has a so-called "live" DVD. But you won't be able to use live CDs or DVDs 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.

On the other hand, if you install everything, including support for various languages, you could require 10GB or more.

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-2.

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

Filesystem

Size (MB)

Mounted Directory

/dev/sda1

100

/boot

/dev/sda2

6000

/

/dev/sda5

4000

/var

/dev/sda6

8000

/usr

/dev/sda7

2000

Swap space

/dev/sda8

20000

/home

/dev/sda9

6000

/home/shared

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. If there's room left over, you can configure these directories on logical volumes and add to them as your needs evolve. 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 use.

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/1,000,000th the speed of RAM, this can cause significant performance problems.

On the Job 

The relative speeds of RAM and hard drives are evolving; in many cases, hard drive access times are fast enough that large amounts of swap space have lower performance penalties. However, the rule of thumb still applies: RAM is much faster than hard drives.

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 earlier, graphical installations of RHEL require at least 192MB of RAM. If your system has the minimum amount of RAM and there's room available on your hard drives, Anaconda configures a swap partition of twice this size (384MB). For Intel 32-bit systems, Red Hat suggests a swap partition at least equal to the amount of RAM on your system. But it isn't required; I have a couple of 2GB systems for which 1GB of swap space is more than sufficient.

On the Job 

Red Hat RAM and swap space requirements vary if you're installing RHEL 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 give Linux flexibility as to 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 1024th cylinder. Some older BIOSs report only 1024 cylinders on a hard drive no matter how many actual cylinders are present. 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 1024 cylinders of the hard drive. Otherwise, the BIOS won't be able to find the partition with the Linux kernel.

Most PCs manufactured for a few years 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. This has been superseded by the Enhanced BIOS, which virtualizes this form of addressing.

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 SATA/SCSI and ATA/IDE controllers in the same machine (which is the situation on my desktop system), but you should be aware of a few snags. Older BIOS may have access only to the first two IDE hard drives. Also, SCSI disks may not be accessible if IDE drives are installed. The BIOS might have a setting to allow you to boot from SCSI hard disks-or even USB keys. Make sure you understand which drives the BIOS will be able to access, because if you install /boot on an inaccessible drive, the BIOS won't be able to find your Linux boot files.



RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302)
Linux Patch Management: Keeping Linux Systems Up To Date
ISBN: 0132366754
EAN: 2147483647
Year: 2004
Pages: 227
Authors: Michael Jang

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