Red Hat Training

A Red Hat training course is available for Red Hat Linux

A.2. Strategies for Disk Repartitioning

There are several different ways that a disk can be repartitioned. This section discusses the following possible approaches:
  • Unpartitioned free space is available
  • An unused partition is available
  • Free space in an actively used partition is available
Note that this section discusses the aforementioned concepts only theoretically and it does not include any procedures showing how to perform disk repartitioning step-by-step. Such detailed information are beyond the scope of this document.

Note

Keep in mind that the following illustrations are simplified in the interest of clarity and do not reflect the exact partition layout that you encounter when actually installing Red Hat Enterprise Linux.

A.2.1. Using Unpartitioned Free Space

In this situation, the partitions already defined do not span the entire hard disk, leaving unallocated space that is not part of any defined partition. The following diagram shows what this might look like:
Disk Drive with Unpartitioned Free Space

Figure A.8. Disk Drive with Unpartitioned Free Space

In the above example, 1 represents an undefined partition with unallocated space and 2 represents a defined partition with allocated space.
An unused hard disk also falls into this category. The only difference is that all the space is not part of any defined partition.
In any case, you can create the necessary partitions from the unused space. Unfortunately, this scenario, although very simple, is not very likely (unless you have just purchased a new disk just for Red Hat Enterprise Linux). Most pre-installed operating systems are configured to take up all available space on a disk drive (see Section A.2.3, “Using Free Space from an Active Partition”).

A.2.2. Using Space from an Unused Partition

In this case, maybe you have one or more partitions that you do not use any longer. The following diagram illustrates such a situation.
Disk Drive with an Unused Partition

Figure A.9. Disk Drive with an Unused Partition

In the above example, 1 represents an unused partition and 2 represents reallocating an unused partition for Linux.
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 delete the unused partition and manually create new partitions during the installation process.

A.2.3. Using Free Space from an Active Partition

This is the most common situation. It is also, unfortunately, the hardest to handle. The main problem is that, even if you have enough free space, it is presently allocated to a partition that is already in use. If you purchased a computer with pre-installed software, the hard disk most likely has one massive partition holding the operating system and data.
Aside from adding a new hard drive to your system, you have two choices:
Destructive Repartitioning
In this case, the single large partition is deleted and several smaller ones are created instead. Any data held in the original partition is destroyed. This means that making a complete backup is necessary. It is highly recommended to make two backups, use verification (if available in your backup software), and try to read data from the backup before deleting the partition.

Warning

If an operating system was installed on that partition, it must be reinstalled if you want to use that system as well. Be aware that some computers sold with pre-installed operating systems might not include the installation media to reinstall the original operating system. You should check whether this applies to your system is before you destroy your original partition and its operating system installation.
After creating a smaller partition for your existing operating system, you can reinstall software, restore your data, and start your Red Hat Enterprise Linux installation.
Disk Drive Being Destructively Repartitioned

Figure A.10. Disk Drive Being Destructively Repartitioned

In the above example, 1 represents before and 2 represents after.

Warning

Any data previously present in the original partition is lost.
Non-Destructive Repartitioning
With non-destructive repartitioning you execute a program that makes a big partition smaller without losing any of the files stored in that partition. This method is usually reliable, but can be very time-consuming on large drives.
While the process of non-destructive repartitioning is rather straightforward, there are three steps involved:
  1. Compress and backup existing data
  2. Resize the existing partition
  3. Create new partition(s)
Each step is described further in more detail.

A.2.3.1. Compress Existing Data

As the following figure shows, the first step is to compress the data in your existing partition. The reason for doing this is to rearrange the data such that it maximizes the available free space at the "end" of the partition.
Disk Drive Being Compressed

Figure A.11. Disk Drive Being Compressed

In the above example, 1 represents before and 2 represents after.
This step is crucial. Without it, the location of the data could prevent the partition from being resized to the extent desired. Note also that, for one reason or another, some data cannot be moved. If this is the case (and it severely restricts the size of your new partitions), you might be forced to destructively repartition your disk.

A.2.3.2. Resize the Existing Partition

Figure A.12, “Disk Drive with Partition Resized” shows the actual resizing process. While the actual result of the resizing operation varies depending on the software used, in most cases the newly freed space is used to create an unformatted partition of the same type as the original partition.
Disk Drive with Partition Resized

Figure A.12. Disk Drive with Partition Resized

In the above example, 1 represents before and 2 represents after.
It is important to understand what the resizing software you use does with the newly freed space, so that you can take the appropriate steps. In the case illustrated here, it would be best to delete the new DOS partition and create the appropriate Linux partition(s).

A.2.3.3. Create new partitions

As the previous step implied, it might or might not be necessary to create new partitions. However, unless your resizing software supports systems with Linux installed, it is likely that you must delete the partition that was created during the resizing process.
Disk Drive with Final Partition Configuration

Figure A.13. Disk Drive with Final Partition Configuration

In the above example, 1 represents before and 2 represents after.