Menu Close
Settings Close

Language and Page Formatting Options

Chapter 3. Disk partitions

To divide a disk into one or more logical areas, use the disk partitioning utility. It enables separate management of each partition.

3.1. Overview of partitions

The hard disk stores information about the location and size of each disk partition in the partition table. Using information from the partition table, the operating system treats each partition as a logical disk. Some of the advantages of disk partitioning include:

  • Reduce the likelihood of administrative oversights of Physical Volumes
  • Ensure sufficient backup
  • Provide efficient disk management

3.2. Considerations before modifying partitions on a disk

Before creating, removing, or resizing any disk partitions, consider the following aspects.

On a device, the type of the partition table determines the maximum number and size of individual partitions.

Maximum number of partitions:

  • On a device formatted with the Master Boot Record (MBR) partition table, you can have:

    • Up to four primary partitions.
    • Up to three primary partitions, one extended partition

      • Multiple logical partitions within the extended partition
  • On a device formatted with the GUID Partition Table (GPT), you can have:

    • Up to 128 partitions, if using the parted utility.

      • Though the GPT specification allows more partitions by increasing the reserved size of the partition table, the parted utility limits the area required for 128 partitions.

Maximum size of partitions:

  • On a device formatted with the Master Boot Record (MBR) partition table:

    • While using 512b sector drives, the maximum size is 2 TiB.
    • While using 4k sector drives, the maximum size is 16 TiB.
  • On a device formatted with the GUID Partition Table (GPT):

    • While using 512b sector drives, the maximum size is 8 ZiB.
    • While using 4k sector drives, the maximum size is 64 ZiB.

By using the parted utility, you can specify the partition size using multiple different suffixes:

  • MiB, GiB, or TiB

    • Size expressed in powers of 2.
    • The starting point of the partition is aligned to the exact sector specified by size.
    • The ending point is aligned to the specified size minus 1 sector.
  • MB, GB, or TB:

    • Size expressed in powers of 10.
    • The starting and ending points are aligned within one half of the specified unit. For example, ±500KB when using the MB suffix.
Note

This section does not cover the DASD partition table, which is specific to the IBM Z architecture.

3.3. Comparison of partition table types

To enable partitions on a device, format a block device with different types of partition tables. The following table compares the properties of different types of partition tables that you can create on a block device.

Table 3.1. Partition table types

Partition tableMaximum number of partitionsMaximum partition size

Master Boot Record (MBR)

4 primary, or 3 primary and 1 extended partition with 12 logical partitions

2TiB

GUID Partition Table (GPT)

128

8ZiB

3.4. MBR disk partitions

The partition table is stored at the very start of the disk, before any file system or user data. For a more clear example, the partition table is shown as being separate in the following diagrams.

Figure 3.1. Disk with MBR partition table

unused partitioned drive

As the previous diagram shows, the partition table is divided into four sections of four unused primary partitions. A primary partition is a partition on a hard drive that contains only one logical drive (or section). Each logical drive holds the information necessary to define a single partition, meaning that the partition table can define no more than four primary partitions.

Each partition table entry contains important characteristics of the partition:

  • The points on the disk where the partition starts and ends
  • The state of the partition, as only one partition can be flagged as active
  • The type of partition

The starting and ending points define the size and location of the partition on the disk. Some of the operating systems boot loaders use the active flag. That means that the operating system in the partition that is marked "active" is booted.

The type is a number that identifies the anticipated usage of a partition. Some operating systems use the partition type to:

  • Denote a specific file system type
  • Flag the partition as being associated with a particular operating system
  • Indicate that the partition contains a bootable operating system

The following diagram shows an example of a drive with a single partition. In this example, the first partition is labeled as DOS partition type:

Figure 3.2. Disk with a single partition

dos single partition

Additional resources

3.5. Extended MBR partitions

To create additional partitions, if needed, set the type to extended.

An extended partition is similar to a disk drive. It has its own partition table, which points to one or more logical partitions, contained entirely within the extended partition. The following diagram shows a disk drive with two primary partitions, and one extended partition containing two logical partitions, along with some unpartitioned free space.

Figure 3.3. Disk with both two primary and an extended MBR partitions

extended partitions

You can have only up to four primary and extended partitions, but there is no fixed limit to the number of logical partitions. As a limit in Linux to access partitions, a single disk drive allows maximum 15 logical partitions.

3.6. MBR partition types

The table below shows a list of some of the most commonly used MBR partition types and hexadecimal numbers to represent them.

Table 3.2. MBR partition types

MBR partition type

Value

MBR partition type

Value

Empty

00

Novell Netware 386

65

DOS 12-bit FAT

01

PIC/IX

75

XENIX root

O2

Old MINIX

80

XENIX usr

O3

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

3.7. GUID Partition Table

The GUID Partition Table (GPT) is a partitioning scheme based on the Globally Unique Identifier (GUID).

GPT deals with the limitations of the MBR partition table. The MBR partition table is unable to address storage larger than 2 TiB, equivalent to approximately 2.2 TB. Instead, GPT supports hard disks with larger capacity. The maximum addressable disk size is 2.2 ZiB In addition, by default, GPT supports creation of up to 128 primary partitions. This number can be extended by allocating more space to the partition table.

Note

A GPT has partition types based on GUIDs. Certain partitions require a specific GUID. For example, the system partition for EFI boot loaders require GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B.

GPT disks use logical block addressing (LBA) and a partition layout as follows:

  • For backward compatibility with MBR disks, the first sector (LBA 0) of GPT is reserved for MBR data and it is called "protective MBR".
  • Primary GPT

    • The 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 on the table.
    • By default, the primary GPT includes 128 partition entries. Each partition has an entry size of 128 bytes, a partition type GUID and a unique partition GUID.
  • Secondary GPT

    • For recovery, it is useful as a backup table in case the primary partition table is corrupted.
    • The secondary GPT header is located on the last logical sector of the disk and recovers 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
      • The secondary partition table
      • The number of possible partition entries

Figure 3.4. Disk with a GUID Partition Table

gpt partition
Important

For a successful installation of the boot loader onto a GPT disk a BIOS boot partition must be present. If the disk already contains a BIOS boot partition, it can be reused. This includes disks initialized by the Anaconda installation program.

3.8. Partition types

There are multiple ways to manage partition types:

  • The fdisk utility supports the full range of partition types by specifying hexadecimal codes.
  • The systemd-gpt-auto-generator, a unit generator utility, uses the partition type to automatically identify and mount devices.
  • The parted utility maps out the partition type with flags. The parted utility handles onlyceratin partition types, for example LVM, swap or RAID.

    The parted utility supports setting the following flags:

    • boot
    • root
    • swap
    • hidden
    • raid
    • lvm
    • lba
    • legacy_boot
    • irst
    • esp
    • palo

On Red Hat Enterprise Linux 9 with parted 3.5, you can use the additional flags chromeos_kernel and bls_boot.

The parted utility optionally accepts a file system type argument while creating a partition. See Creating a partition with parted for a list of the required conditions. Use the value to:

  • Set the partition flags on MBR.
  • Set the partition UUID type on GPT. For example, the swap, fat, or hfs file system types set different GUIDs. The default value is the Linux Data GUID.

The argument does not modify the file system on the partition. It only differentiates between the supported flags and GUIDs.

The following file system types are supported:

  • xfs
  • ext2
  • ext3
  • ext4
  • fat16
  • fat32
  • hfs
  • hfs+
  • linux-swap
  • ntfs
  • reiserfs

3.9. Partition naming scheme

Red Hat Enterprise Linux uses a file-based naming scheme, with file names in the form of /dev/xxyN.

Device and partition names consist of the following structure:

/dev/
Name of the directory that contains all device files. Hard disks contain partitions, thus the files representing all possible partitions are located in /dev.
xx
The first two letters of the partition name indicate the type of device that contains the partition.
y
This letter indicates the specific device containing the partition. For example, /dev/sda for the first hard disk and /dev/sdb for the second. You can use more letters in systems with more than 26 drives, for example, /dev/sdaa1.
N
The final letter indicates the number to represent the partition. The first four (primary or extended) partitions are numbered 1 through 4. Logical partitions start at 5. For example, /dev/sda3 is the third primary or extended partition on the first hard disk, and /dev/sdb6 is the second logical partition on the second hard disk. Drive partition numbering applies only to MBR partition tables. Note that N does not always mean partition.
Note

Even if Red Hat Enterprise Linux can identify and refer to all types of disk partitions, it might not be able to read the file system and therefore access stored data on every partition type. However, in many cases, it is possible to successfully access data on a partition dedicated to another operating system.

3.10. Mount points and disk partitions

In Red Hat Enterprise Linux, each partition forms a part of the storage, necessary to support a single set of files and directories. Mounting a partition makes the storage of that partition available, starting at the specified directory known as a mount point.

For example, if partition /dev/sda5 is mounted on /usr/, it means that all files and directories under /usr/ physically reside on /dev/sda5. The file /usr/share/doc/FAQ/txt/Linux-FAQ resides on /dev/sda5, while the file /etc/gdm/custom.conf does not.

Continuing the example, it is also possible that one or more directories below /usr/ would be mount points for other partitions. For example, /usr/local/man/whatis resides on /dev/sda7, rather than on /dev/sda5, if /usr/local includes a mounted /dev/sda7 partition.