Disk partitions are a standard part of the personal computer landscape and have been for quite some time. However, with many people purchasing computers featuring pre-installed operating systems, relatively few people understand how partitions work. This chapter attempts to explain the reasons for and use of disk partitions so your Red Hat Enterprise Linux installation is as simple and painless as possible. Show
If you are reasonably comfortable with disk partitions, you could skip ahead to Section C.1.4 Making Room For Red Hat Enterprise Linux, for more information on the process of freeing up disk space to prepare for a Red Hat Enterprise Linux installation. This section also discusses the partition naming scheme used by Linux systems, sharing disk space with other operating systems, and related topics. C.1. Hard Disk Basic ConceptsHard disks perform a very simple function — they store data and reliably retrieve it on command. When discussing issues such as disk partitioning, it is important to know a bit about the underlying hardware. Unfortunately, it is easy to become bogged down in details. Therefore, this appendix uses a simplified diagram of a disk drive to help explain what is really happening when a disk drive is partitioned. Figure C-1, shows a brand-new, unused disk drive. Figure C-1. An Unused Disk Drive Not much to look at, is it? But if we are talking about disk drives on a basic level, it is adequate. Say that we would like to store some data on this drive. As things stand now, it will not work. There is something we need to do first… C.1.1. It is Not What You Write, it is How You Write ItExperienced computer users probably got this one on the first try. We need to format the drive. Formatting (usually known as "making a file system") writes information to the drive, creating order out of the empty space in an unformatted drive. Figure C-2. Disk Drive with a File System As Figure C-2, implies, the order imposed by a file system involves some trade-offs:
Given that file systems make things like directories and files possible, these tradeoffs are usually seen as a small price to pay. It is also worth noting that there is no single, universal file system. As Figure C-3, shows, a disk drive may have one of many different file systems written on it. As you might guess, different file systems tend to be incompatible; that is, an operating system that supports one file system (or a handful of related file system types) may not support another. This last statement is not a hard-and-fast rule, however. For example, Red Hat Enterprise Linux supports a wide variety of file systems (including many commonly used by other operating systems), making data interchange between different file systems easy. Figure C-3. Disk Drive with a Different File System Of course, writing a file system to disk is only the beginning. The goal of this process is to actually store and retrieve data. Let us take a look at our drive after some files have been written to it. Figure C-4. Disk Drive with Data Written to It As Figure C-4, shows, some of the previously-empty blocks are now holding data. However, by just looking at this picture, we cannot determine exactly how many files reside on this drive. There may only be one file or many, as all files use at least one block and some files use multiple blocks. Another important point to note is that the used blocks do not have to form a contiguous region; used and unused blocks may be interspersed. This is known as fragmentation. Fragmentation can play a part when attempting to resize an existing partition. As with most computer-related technologies, disk drives changed over time after their introduction. In particular, they got bigger. Not larger in physical size, but bigger in their capacity to store information. And, this additional capacity drove a fundamental change in the way disk drives were used. C.1.2. Partitions: Turning One Drive Into ManyAs disk drive capacities soared, some people began to wonder if having all of that formatted space in one big chunk was such a great idea. This line of thinking was driven by several issues, some philosophical, some technical. On the philosophical side, above a certain size, it seemed that the additional space provided by a larger drive created more clutter. On the technical side, some file systems were never designed to support anything above a certain capacity. Or the file systems could support larger drives with a greater capacity, but the overhead imposed by the file system to track files became excessive. The solution to this problem was to divide disks into partitions. Each partition can be accessed as if it was a separate disk. This is done through the addition of a partition table.
Figure C-5. Disk Drive with Partition Table As Figure C-5, shows, the partition table is divided into four sections. Each section can hold the information necessary to define a single partition, meaning that the partition table can define no more than four partitions. Each partition table entry contains several important characteristics of the partition:
Let us take a closer look at each of these characteristics. The starting and ending points actually define the partition's size and location on the disk. The "active" flag is used by some operating systems' boot loaders. In other words, the operating system in the partition that is marked "active" is booted. The partition's type can be a bit confusing. The type is a number that identifies the partition's anticipated usage. If that statement sounds a bit vague, that is because the meaning of the partition type is a bit vague. Some operating systems use the partition type to denote a specific file system type, to flag the partition as being associated with a particular operating system, to indicate that the partition contains a bootable operating system, or some combination of the three. By this point, you might be wondering how all this additional complexity is normally used. Refer to Figure C-6, for an example. Figure C-6. Disk Drive With Single Partition In many cases, there is only a single partition spanning the entire disk, essentially duplicating the method used before partitions. The partition table has only one entry used, and it points to the start of the partition. We have labeled this partition as being of the "DOS" type. Although it is only one of several possible partition types listed in Table C-1, it is adequate for the purposes of this discussion. Table C-1, contains a listing of some popular (and obscure) partition types, along with their hexidecimal numeric values.
Table C-1. Partition Types C.1.3. Partitions within Partitions — An Overview of Extended PartitionsOf course, over time it became obvious that four partitions would not be enough. As disk drives continued to grow, it became more and more likely that a person could configure four reasonably-sized partitions and still have disk space left over. There needed to be some way of creating more partitions. Enter the extended partition. As you may have noticed in Table C-1, there is an "Extended" partition type. It is this partition type that is at the heart of extended partitions. When a partition is created and its type is set to "Extended," an extended partition table is created. In essence, the extended partition is like a disk drive in its own right — it has a partition table that points to one or more partitions (now called logical partitions, as opposed to the four primary partitions) contained entirely within the extended partition itself. Figure C-7, shows a disk drive with one primary partition and one extended partition containing two logical partitions (along with some unpartitioned free space). Figure C-7. Disk Drive With Extended Partition As this figure implies, there is a difference between primary and logical partitions — there can only be four primary partitions, but there is no fixed limit to the number of logical partitions that can exist. However, due to the way in which partitions are accessed in Linux, you should avoid defining more than 12 logical paritions on a single disk drive. Now that we have discussed partitions in general, let us review how to use this knowledge to install Red Hat Enterprise Linux. C.1.4. Making Room For Red Hat Enterprise LinuxThere are three possible scenarios you may face when attempting to repartition your hard disk:
Let us look at each scenario in order.
C.1.4.1. Using Unpartitioned Free SpaceIn this situation, the partitions already defined do not span the entire hard disk, leaving unallocated space that is not part of any defined partition. Figure C-8, shows what this might look like. Figure C-8. Disk Drive with Unpartitioned Free Space In Figure C-8, 1 represents an undefined partition with unallocated space and 2 represents a defined partition with allocated space. If you think about it, an unused hard disk also falls into this category. The only difference is that all the space is not part of any defined partition. Next, we will discuss a slightly more common situation. C.1.4.2. Using Space from an Unused PartitionIn this case, maybe you have one or more partitions that you do not use any longer. Perhaps you have dabbled with another operating system in the past, and the partition(s) you dedicated to it never seem to be used anymore. Figure C-9, illustrates such a situation. Figure C-9. Disk Drive With an Unused Partition In Figure C-9, 1 represents an unused partition and 2 represents reallocating an unused partition for Linux. If you find yourself in this situation, you can use the space allocated to the unused partition. You first must delete the partition and then create the appropriate Linux partition(s) in its place. You can create partitions manually during the installation process and delete the partition before creating a new one. C.1.5. Partition Naming SchemeLinux refers to disk partitions using a combination of letters and numbers which may be confusing, particularly if you are used to the "C drive" way of referring to hard disks and their partitions. In the DOS/Windows world, partitions are named using the following method:
Red Hat Enterprise Linux uses a naming scheme that is more flexible and conveys more information than the approach used by other operating systems. The naming scheme is file-based, with file names in the form of /dev/xxyN. Here is how to decipher the partition naming scheme: /dev/ This is the name of the directory in which all device files reside. Since partitions reside on hard disks, and hard disks are devices, the files representing all possible partitions reside in /dev/. xxThe first two letters of the partition name indicate the type of device on which the partition resides, usually either hd (for IDE disks) or sd (for SCSI disks). yThis letter indicates which device the partition is on. For example, /dev/hda (the first IDE hard disk) or /dev/sdb (the second SCSI disk). NThe final number denotes the partition. The first four (primary or extended) partitions are numbered 1 through 4. Logical partitions start at 5. So, for example, /dev/hda3 is the third primary or extended partition on the first IDE hard disk, and /dev/sdb6 is the second logical partition on the second SCSI hard disk.
Keep this information in mind; it makes things easier to understand when you are setting up the partitions Red Hat Enterprise Linux requires. C.1.6. Disk Partitions and Other Operating SystemsIf your Red Hat Enterprise Linux partitions are sharing a hard disk with partitions used by other operating systems, most of the time you will have no problems. However, there are certain combinations of Linux and other operating systems that require extra care. C.1.7. Disk Partitions and Mount PointsOne area that many people new to Linux find confusing is the matter of how partitions are used and accessed by the Linux operating system. In DOS/Windows, it is relatively simple: Each partition gets a "drive letter." You then use the correct drive letter to refer to files and directories on its corresponding partition. This is entirely different from how Linux deals with partitions and, for that matter, with disk storage in general. The main difference is that each partition is used to form part of the storage necessary to support a single set of files and directories. This is done by associating a partition with a directory through a process known as mounting. Mounting a partition makes its storage available starting at the specified directory (known as a mount point). For example, if partition /dev/hda5 is mounted on /usr/, that would mean that all files and directories under /usr/ physically reside on /dev/hda5. So the file /usr/share/doc/FAQ/txt/Linux-FAQ would be stored on /dev/hda5, while the file /etc/X11/gdm/Sessions/Gnome would not. Continuing our example, it is also possible that one or more directories below /usr/ would be mount points for other partitions. For instance, a partition (say, /dev/hda7) could be mounted on /usr/local/, meaning that /usr/local/man/whatis would then reside on /dev/hda7 rather than /dev/hda5. C.1.8. How Many Partitions?At this point in the process of preparing to install Red Hat Enterprise Linux, you must give some consideration to the number and size of the partitions to be used by your new operating system. The question of "how many partitions" continues to spark debate within the Linux community and, without any end to the debate in sight, it is safe to say that there are probably as many partition layouts as there are people debating the issue. Keeping this in mind, we recommend that, unless you have a reason for doing otherwise, you should at least create the following partitions: swap, /boot/ (a /boot/ file is only necessary for pSeries systems, not iSeries systems), PPC PReP Boot, and / (root). Note that new virtual disks can be added dynamically on OS/400 release V5R2 and later. For more information, refer to Section 2.15.4 Recommended Partitioning Scheme. Which of the following is a partition type that Cannot have a drive letter assigned?An extended partition is a partition that can be divided into additional logical drives. Unlike a primary partition, you don't need to assign it a drive letter and install a file system. Instead, you can use the operating system to create an additional number of logical drives within the extended partition.
Which drive letter will be assigned to the drive?Computers containing a hard drive always have that default hard drive assigned to a C: drive letter, and the CD-ROM or another disc drive is the last drive letter (e.g., D:).
What are the three types of partitions?Different Drive Partitions. Primary Partition: Contains one file system and typically stores the boot files for the primary operating system. ... . Extended Partition: A defined area where logical drives are stored. ... . Logical Partition: Can be used to store data, but can't boot an operating system.. What is the drive letter of the default partition?The drive letter standard, with the colon (:), dates back to before DOS. By default, in Windows (and in DOS before it), the boot drive is C:. Other drives, whether they're internal, external, optical, or additional partitions, get other letters, usually in the order they were assigned: D:, E:, and so on.
|