Product SiteDocumentation Site

An Introduction to Disk Partitions

Note

This appendix is not necessarily applicable to architectures other than AMD64 and Intel 64. However, the general concepts mentioned here may apply.
This section discusses basic disk concepts, disk repartitioning strategies, the partition naming scheme used by Linux systems, and related topics.
If you are comfortable with disk partitions, you can skip ahead to Section B.2, “Strategies for Disk Repartitioning” for more information on the process of freeing up disk space to prepare for a Fedora installation.

B.1. Hard Disk Basic Concepts

Hard 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 have a understanding of the underlying hardware; however, since the theory is very complicated and expansive, only the basic concepts will be explained here. This appendix uses a set of simplified diagrams of a disk drive to help explain what is the process and theory behind partitions.
Figure B.1, “An Unused Disk Drive”, shows a brand-new, unused disk drive.
An Unused Disk Drive
Image of an unused disk drive.
Figure B.1. An Unused Disk Drive

B.1.1. File Systems

To store data on a disk drive, it is necessary to format the disk drive first. Formatting (usually known as "making a file system") writes information to the drive, creating order out of the empty space in an unformatted drive.
Disk Drive with a File System
Image of a formatted disk drive.
Figure B.2. Disk Drive with a File System

As Figure B.2, “Disk Drive with a File System”, implies, the order imposed by a file system involves some trade-offs:
  • A small percentage of the driver'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. [1]
Note that there is no single, universal file system. As Figure B.3, “Disk Drive with a Different File System”, shows, a disk drive may have one of many different file systems written on it. 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. However, Fedora supports a wide variety of file systems (including many commonly used by other operating systems such as Microsoft Windows), making data interchange between different file systems easy.
Disk Drive with a Different File System
Image of a disk drive with a different file system.
Figure B.3. Disk Drive with a Different File System

Writing a file system to disk is only the first step. The goal of this process is to actually store and retrieve data. The figure below shows a drive disk after some data have been written to it:
Disk Drive with Data Written to It
Image of a disk drive with data written to it.
Figure B.4. Disk Drive with Data Written to It

As Figure B.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.

B.1.2. Partitions: Turning One Drive Into Many

Disk drives can be divided into partitions. Each partition can be accessed as if it was a separate disk. This is done through the addition of a partition table.
There are several reasons for allocating disk space into separate disk partitions, for example:
  • Logical separation of the operating system data from the user data
  • Ability to use different file systems
  • Ability to run multiple operating systems on one machine
There are currently two partitioning layout standards for physical hard disks: Master Boot Record (MBR) and GUID Partition Table (GPT). MBR is an older method of disk partitioning used with BIOS-based computers. GPT is a newer partitioning layout that is a part of the Unified Extensible Firmware Interface (UEFI). This section and Section B.1.3, “Partitions Within Partitions - An Overview of Extended Partitions” mainly describe the Master Boot Record (MBR) disk partitioning scheme. For information about the GUID Partition Table (GPT) partitioning layout, see Section B.1.4, “GUID Partition Table (GPT)”.

Note

While the diagrams in this chapter show the partition table as being separate from the actual disk drive, this is not entirely accurate. In reality, the partition table is stored at the very start of the disk, before any file system or user data. But for clarity, they are separate in our diagrams.
Disk Drive with Partition Table
Image of an unused disk drive with a partition table.
Figure B.5. Disk Drive with Partition Table

As Figure B.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
The starting and ending points 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 type is a number that identifies the partition's anticipated usage. 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.
See Figure B.6, “Disk Drive With Single Partition” for an example of a disk drive with single partition.
Disk Drive With Single Partition
Image of a disk drive with a single partition.
Figure B.6. Disk Drive With Single Partition

The single partition in this example is labeled as DOS. This label shows the partition type, with DOS being one of the most common ones. The table below shows a list of some of the commonly used partition types and hexadecimal numbers used to represent them.
Table B.1. Partition Types
Partition Type Value Partition Type Value
Empty 00 Novell Netware 386 65
DOS 12-bit FAT 01 PIC/IX 75
XENIX root 02 Old MINIX 80
XENIX usr 03 Linux/MINUX 81
DOS 16-bit <=32M 04 Linux swap 82
Extended 05 Linux native 83
DOS 16-bit >=32 06 Linux extended 85
OS/2 HPFS 07 Amoeba 93
AIX 08 Amoeba BBT 94
AIX bootable 09 BSD/386 a5
OS/2 Boot Manager 0a OpenBSD a6
Win95 FAT32 0b NEXTSTEP a7
Win95 FAT32 (LBA) 0c BSDI fs b7
Win95 FAT16 (LBA) 0e BSDI swap b8
Win95 Extended (LBA) 0f Syrinx c7
Venix 80286 40 CP/M db
Novell 51 DOS access e1
PReP Boot 41 DOS R/O e3
GNU HURD 63 DOS secondary f2
Novell Netware 286 64 BBT ff

B.1.3. Partitions Within Partitions - An Overview of Extended Partitions

In case four partitions are insufficient for your needs, you can use extended partitions to create up additional partitions. You do this by setting the type of a partition to "Extended".
An extended partition is like a disk drive in its own right - it has its own partition table which 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 B.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).
Disk Drive With Extended Partition
Image of a disk drive with an extended partition.
Figure B.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, no more than 12 logical partitions should be defined on a single disk drive.

B.1.4. GUID Partition Table (GPT)

GUID Partition Table (GPT) is a newer partitioning scheme based on using Globally Unique Identifiers (GUID). GPT was developed to cope with limitations of the MBR partition table, especially with the limited maximum addressable storage space of a disk. Unlike MBR, which is unable to address storage space larger than 2.2 terabytes, GPT can be used with hard disks larger than this; the maximum addressable disk size is 2.2 zettabytes. In addition, GPT by default supports creating up to 128 primary partitions. This number could be extended by allocating more space to the partition table.
GPT disks use logical block addressing (LBA) and the partition layout is as follows:
  • To preserve backward compatibility with MBR disks, the first sector (LBA 0) of GPT is reserved for MBR data and it is called protective MBR.
  • The primary GPT header begins on the second logical block (LBA 1) of the device. The header contains the disk GUID, the location of the primary partition table, the location of the secondary GPT header, and CRC32 checksums of itself and the primary partition table. It also specifies the number of partition entries of the table.
  • The primary GPT table includes, by default, 128 partition entries, each with an entry size 128 bytes, its partition type GUID and unique partition GUID.
  • The secondary GPT table is identical to the primary GPT table. It is used mainly as a backup table for recovery in case the primary partition table is corrupted.
  • The secondary GPT header is located on the last logical sector of the disk and it can be used to recover GPT information in case the primary header is corrupted. It contains the disk GUID, the location of the secondary partition table and the primary GPT header, CRC32 checksums of itself and the secondary partition table, and the number of possible partition entries.

Important

There must be a BIOS boot partition for the boot loader to be installed successfully onto a disk that contains a GPT (GUID Partition Table). This includes disks initialized by Anaconda. If the disk already contains a BIOS boot partition, it can be reused.


[1] Blocks really are consistently sized, unlike our illustrations. Keep in mind, also, that an average disk drive contains thousands of blocks. The picture is simplified for the purposes of this discussion.