This appendix is not necessarily applicable to non-x86-based architectures. However, the general concepts mentioned here may apply.
This appendix is not necessarily applicable to non-x86-based architectures. However, the general concepts mentioned here may apply.
If you are reasonably comfortable with disk partitions, you could skip ahead to Section A.1.4, “Making Room For Fedora”, for more information on the process of freeing up disk space to prepare for a Fedora installation. This section also discusses the partition naming scheme used by Linux systems, sharing disk space with other operating systems, and related topics.
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.
A.1.1. It is Not What You Write, it is How You Write It
A small percentage of the drive's available space is used to store file system-related data and can be considered as overhead.
A file system splits the remaining space into small, consistently-sized segments. For Linux, these segments are known as blocks. [5]
Given that file systems make things like directories and files possible, these trade-offs are usually seen as a small price to pay.
It is also worth noting that there is no single, universal file system. As Figure A.3, “Disk Drive with a Different File System”, 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, Fedora supports a wide variety of file systems (including many commonly used by other operating systems), making data interchange between different file systems easy.
Image of a disk drive with a different file system.
Figure A.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.
Image of a disk drive with data written to it.
Figure A.4. Disk Drive with Data Written to It
As Figure A.4, “Disk Drive with Data Written to It”, 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.
As Figure A.5, “Disk Drive with Partition Table” shows, the partition table is divided into four sections or four primary partitions. A primary partition is a partition on a hard drive that can contain only one logical drive (or section). 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:
The points on the disk where the partition starts and ends
Whether the partition is "active"
The partition's type
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.
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 A.1, “Partition Types”, it is adequate for the purposes of this discussion.
Table A.1, “Partition Types”, contains a listing of some popular (and obscure) partition types, along with their hexadecimal numeric values.
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 A.7, “Disk Drive With Extended Partition”, shows a disk drive with one primary partition and one extended partition containing two logical partitions (along with some unpartitioned free space).
Image of a disk drive with an extended partition.
Figure A.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 partitions on a single disk drive.
Now that we have discussed partitions in general, let us review how to use this knowledge to install Fedora.
Image of a disk drive with unpartitioned free space, where 1 represents an undefined partition with unallocated space and 2 represents a defined partition with allocated space.
Figure A.8. Disk Drive with Unpartitioned Free 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.
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 Fedora). Most pre-installed operating systems are configured to take up all available space on a disk drive (refer to Section A.1.4.3, “Using Free Space from an Active Partition”).
Next, we will discuss a slightly more common situation.
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 delete the unused partition and manually create new partitions during the installation process.
A.1.4.3. Using Free Space from an Active Partition
As Figure A.11, “Disk Drive Being Compressed”, 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.
Image of a disk drive being compressed, where 1 represents before and 2 represents after.
This step is crucial. Without it, the location of your 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 partition(s)), you may be forced to destructively repartition your disk.
A.1.4.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.
Image of a disk drive with a resized partition, where 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 we have illustrated, it would be best to delete the new DOS partition and create the appropriate Linux partition(s).
A.1.4.3.3. Create new partition(s)
As the previous step implied, it may or may not be necessary to create new partitions. However, unless your resizing software is Linux-aware, it is likely that you must delete the partition that was created during the resizing process. Figure A.13, “Disk Drive with Final Partition Configuration”, shows this being done.
Image of a disk drive with final partition configuration, where 1 represents before and 2 represents after.
Figure A.13. Disk Drive with Final Partition Configuration
[5]
Blocks really are consistently sized, unlike our illustrations. Keep in mind, also, that an average disk drive contains thousands of blocks. But for the purposes of this discussion, please ignore these minor discrepancies.