LFCS 73 ๐ง Partitioning โ Concepts
Partitioning is the act of dividing a physical disk into logical regions that the operating system treats as separate block devices. Every filesystem, swap area, and LVM physical volume begins as a partition or a whole disk. The LFCS objective is not about memorizing the fdisk menu; it is about understanding the two partition table formatsโMBR and GPTโand the constraints each imposes on disk size, partition count, and boot compatibility. A disk partitioned with the wrong table type for its intended role will fail to boot or fail to use the available capacity, and the failure mode is not always obvious.
Key point: MBR is limited to 2 TB and four primary partitions. GPT has no practical size limit and supports 128 partitions by default, all of which are primary. The partition table type is determined at the moment the table is written, and changing it destroys the existing partition layout.
Why partitioning concepts matter
The boot compatibility problem. A system with legacy BIOS requires a boot disk formatted with MBR. A system with UEFI requires a boot disk formatted with GPT . Using the wrong combination produces a disk that the firmware cannot boot, even if the partitions and filesystems are otherwise correct. The partition table type is not a preference; it is a compatibility requirement determined by the firmware.
The capacity problem. MBR stores partition offsets as 32-bit sector counts. With 512-byte sectors, this caps the addressable space at 2 TB . A 4 TB disk partitioned with MBR can only use the first 2 TB. GPT uses 64-bit block addresses, which removes the practical limit . On modern hardware, MBR is a liability unless the disk is small or the system requires legacy BIOS compatibility.
The partition count problem. MBR’s partition table has room for four entries. These are the primary partitions. To create more than four, one primary partition must be designated as an extended partition, which contains a linked list of logical partitions numbered from 5 onward . GPT does not have this distinction. All GPT partitions are primary, and the default limit is 128 .
The tool selection problem. fdisk historically handled MBR and did not understand GPT. gdisk was created as the GPT-aware counterpart with an almost identical interface . Modern fdisk handles both, and parted handles both with a different commit modelโchanges are applied immediately rather than staged until w . The tool choice affects the risk of accidental changes, not the capabilities.
a. MBR: Primary, Extended, and Logical Partitions
The MBR partition table occupies the first sector of the disk. It contains four 16-byte entries, each describing a primary partition. The partition numbers 1 through 4 correspond to these entries, whether or not the partitions exist . A disk with two primary partitions has entries for partitions 1 and 2 populated and entries for 3 and 4 empty.
If more than four partitions are needed, one primary entry is used for an extended partition. The extended partition is not a data partition. It is a container whose first sector holds another partition table with entries for logical partitions. The logical partitions are numbered starting at 5, and each logical partition’s descriptor points to the next, forming a chain . The extended partition itself has a type ID of 5 (or f for LBA), and the logical partitions typically have type 83 for Linux native or 82 for Linux swap .
# Example MBR layout with one extended partition
# /dev/sdb1 primary (data)
# /dev/sdb2 primary (data)
# /dev/sdb3 extended (container, not usable for data)
# /dev/sdb5 logical (data, inside sdb3)
# /dev/sdb6 logical (data, inside sdb3)
The practical consequence is that an MBR disk with an extended partition sacrifices one of the four primary slots to the container. The maximum number of usable partitions is four if no extended partition is used, or three primaries plus an arbitrary number of logical partitions (subject to kernel limits) if it is.
b. GPT: Uniform Partitions and Protective MBR
GPT replaces the MBR partition table with a GUID Partition Table. The table is larger and stores partition entries with 64-bit LBA addresses, GUIDs, and names. The default limit in most tools is 128 partitions, all treated as primary . There is no extended partition, no logical partition chain, and no four-entry limit.
GPT also includes a protective MBR in the first sector. This is a legacy compatibility measure: it occupies the space where an MBR table would be and marks the disk as GPT, preventing older MBR-only tools from misinterpreting the GPT disk and overwriting it . The protective MBR does not contain a real partition table, and it does not impose MBR constraints on the GPT layout.
# GPT layout with four partitions
# /dev/sdb1 primary
# /dev/sdb2 primary
# /dev/sdb3 primary
# /dev/sdb4 primary
# All are primary; there is no extended or logical distinction.
The boot compatibility rule is that UEFI requires GPT for the boot disk, and legacy BIOS requires MBR for the boot disk. A non-boot data disk can use GPT on a legacy BIOS system, because the firmware does not need to read the partition table to boot from it .
c. Partition Types and Swap
Each partition has a type ID that tells the operating system what the partition is intended for. In MBR, the type ID is a hex value stored in the partition entry. 83 is Linux native, 82 is Linux swap, 5 or f is extended . In GPT, the type is a GUID. The concept is the same: the type is a hint to the OS and to tools, not an enforced constraint. A partition with type 83 can be formatted as ext4, XFS, or anything else; the type ID does not prevent it.
Swap space is a dedicated partition or file used when physical memory is full. The Red Hat documentation recommends a dedicated swap partition over a swap file, and provides size guidelines based on RAM and whether hibernation is needed . For a system with 2 GB of RAM, the recommendation is 2ร RAM for swap, or 3ร if hibernation is allowed. For systems with more than 64 GB of RAM, hibernation is not recommended, and at least 4 GB of swap is sufficient . These are guidelines, not requirements. The exam may test the ability to create a swap partition and activate it with mkswap and swapon.
Complete Example Session
# ============================================
# PART 1: IDENTIFY THE DISK AND ITS TABLE TYPE
# ============================================
# List block devices in tree format
lsblk
# Check the partition table type
lsblk -o NAME,PTTYPE,SIZE /dev/sdb
# PTTYPE column shows "dos" for MBR or "gpt" for GPT
# ============================================
# PART 2: INSPECT AN MBR DISK WITH FDISK
# ============================================
sudo fdisk -l /dev/sdb
# Output shows "Disklabel type: dos"
# Lists primary partitions 1-4 and any logical partitions from 5
# ============================================
# PART 3: CREATE AN MBR PARTITION TABLE
# ============================================
sudo fdisk /dev/sdb
# At the fdisk prompt:
# o โ create a new empty DOS (MBR) partition table
# n โ new partition
# p โ primary
# 1 โ partition number
# <Enter> โ default first sector
# +2G โ size
# w โ write and exit
# ============================================
# PART 4: CREATE AN EXTENDED PARTITION
# ============================================
sudo fdisk /dev/sdb
# n โ new partition
# e โ extended
# 2 โ partition number (if 2 is free)
# <Enter> โ default start
# <Enter> โ default end (use remaining space)
# w โ write
# ============================================
# PART 5: CREATE LOGICAL PARTITIONS
# ============================================
sudo fdisk /dev/sdb
# n โ new partition
# l โ logical (fdisk defaults to logical inside extended)
# <Enter> โ default start
# +1G โ size
# w โ write
# Repeat for sdb6, sdb7 as needed
# ============================================
# PART 6: INSPECT A GPT DISK WITH GDISK
# ============================================
sudo gdisk -l /dev/sdc
# Output shows "GPT: present"
# Lists partitions 1-128, all primary
# ============================================
# PART 7: CREATE A GPT PARTITION TABLE
# ============================================
sudo gdisk /dev/sdc
# o โ create a new empty GPT
# n โ new partition
# 1 โ partition number
# <Enter> โ default first sector
# <Enter> โ default last sector
# 8300 โ Linux filesystem type code
# w โ write
# ============================================
# PART 8: SET PARTITION TYPE FOR SWAP (MBR)
# ============================================
sudo fdisk /dev/sdb
# t โ change partition type
# 5 โ partition number
# 82 โ Linux swap type ID
# w โ write
# ============================================
# PART 9: REFRESH THE KERNEL PARTITION TABLE
# ============================================
sudo partprobe /dev/sdb
# Re-reads the partition table without a reboot
# ============================================
# PART 10: VERIFY THE LAYOUT
# ============================================
lsblk /dev/sdb
# Shows the partition tree with sizes and mount points
The ten parts trace the inspection and creation of both table types. Parts 3 through 5 show the MBR primary/extended/logical sequence. Parts 6 and 7 show the GPT equivalent, where all partitions are primary.
Quick Reference
MBR vs. GPT
| Aspect | MBR | GPT |
|---|---|---|
| Maximum disk size | 2 TB | No practical limit |
| Primary partitions | 4 | 128 (default) |
| Extended/logical | Yes, beyond 4 | No |
| Boot compatibility | Legacy BIOS | UEFI |
| Protective MBR | N/A | Present in first sector |
| Tool | fdisk | gdisk, parted, modern fdisk |
MBR Partition Types
| ID | Meaning |
|---|---|
83 | Linux native |
82 | Linux swap |
5 or f | Extended partition |
8e | Linux LVM |
Partition Numbering (MBR)
| Number | Type |
|---|---|
| 1โ4 | Primary or extended |
| 5+ | Logical (inside extended) |
Best Practices
โ Do This:
# Check the existing table type before modifying
lsblk -o NAME,PTTYPE,SIZE /dev/sdX # โ
# Use gdisk or parted for GPT disks
sudo gdisk /dev/sdX # โ
# Refresh the kernel table after changes
sudo partprobe /dev/sdX # โ
# Use a dedicated swap partition
sudo mkswap /dev/sdX1 && sudo swapon /dev/sdX1 # โ
โ Don’t Do This:
# Use MBR on a disk larger than 2 TB
# Space beyond 2 TB is unusable # โ
# Use MBR for a UEFI boot disk
# Firmware cannot boot from it # โ
# Assume logical partitions can be used for boot
# Logical partitions are often not bootable # โ
# Change the partition table without verifying the target disk
# Irreversible data loss on the wrong device # โ
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| Disk larger than 2 TB shows only 2 TB | MBR table | Use GPT |
| Cannot create fifth partition | MBR four-primary limit | Create extended partition, use logical |
| UEFI system does not boot | MBR boot disk | Reformat boot disk with GPT |
| fdisk does not recognize GPT | Old fdisk version | Use gdisk or parted |
| Kernel does not see new partitions | Table not re-read | partprobe /dev/sdX |
Real-World Examples
1. Check Table Type
lsblk -o NAME,PTTYPE /dev/sdb
2. List MBR Partitions
sudo fdisk -l /dev/sdb
3. List GPT Partitions
sudo gdisk -l /dev/sdc
4. Create MBR Table
sudo fdisk /dev/sdb
# o, w
5. Create GPT Table
sudo gdisk /dev/sdc
# o, w
6. Create Extended Partition
sudo fdisk /dev/sdb
# n, e, <Enter>, <Enter>, w
7. Create Logical Partition
sudo fdisk /dev/sdb
# n, l, <Enter>, +1G, w
8. Set Swap Type
sudo fdisk /dev/sdb
# t, 5, 82, w
9. Refresh Kernel Table
sudo partprobe /dev/sdb
10. Format Swap
sudo mkswap /dev/sdb5
sudo swapon /dev/sdb5
Visual
MBR Partition Table Structure
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MBR (Sector 0) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Partition 1 entry (primary or extended) โโ
โ โ Partition 2 entry (primary or extended) โโ
โ โ Partition 3 entry (primary or extended) โโ
โ โ Partition 4 entry (primary or extended) โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ If entry 3 is extended: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Extended container (sdb3) โโ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโ
โ โ โ Logical partition 5 (sdb5) โโโ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โโ
โ โ โ Logical partition 6 (sdb6) โโโ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โโ
โ โ โ Logical partition 7 (sdb7) โโโ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ Four primary slots. One can be an extended container. โ
โ Logical partitions numbered from 5. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
GPT Partition Table Structure
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GPT โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Protective MBR (first sector) โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโคโ
โ โ GPT header โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโคโ
โ โ Partition entry 1 (primary) โโ
โ โ Partition entry 2 (primary) โโ
โ โ Partition entry 3 (primary) โโ
โ โ ... โโ
โ โ Partition entry 128 (primary) โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ No extended partition. No logical partition chain. โ
โ All partitions are primary. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Tool Comparison
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TOOL TABLE COMMIT MODEL โ
โ โ
โ fdisk MBR + GPT Staged (w to write) โ
โ gdisk GPT Staged (w to write) โ
โ parted MBR + GPT Immediate (per command) โ
โ โ
โ fdisk and gdisk: changes are not applied until w โ
โ parted: each command takes effect immediately โ
โ โ
โ For scripting, parted's immediate model is convenient โ
โ but less forgiving of mistakes. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Boot Compatibility
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FIRMWARE BOOT DISK TABLE โ
โ โ
โ Legacy BIOS โโโบ MBR required โ
โ UEFI โโโบ GPT required โ
โ โ
โ Non-boot data disk: โ
โ Either table works on either firmware. โ
โ โ
โ The boot disk is the constraint. โ
โ Data disks can use GPT regardless of firmware. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Item | Value |
|---|---|
| MBR max disk size | 2 TB |
| MBR primary partitions | 4 |
| MBR extended partition | Container for logical partitions |
| Logical partition numbering | Starts at 5 |
| GPT max partitions | 128 (default) |
| GPT partition type | All primary |
| GPT protective MBR | First sector, legacy compatibility |
| Boot compatibility | BIOS โ MBR; UEFI โ GPT |
| MBR Linux native type | 83 |
| MBR Linux swap type | 82 |
Key takeaways:
- The partition table type is determined at creation and changing it destroys the layout.
fdiskwithocreates an empty MBR table.gdiskwithocreates an empty GPT table. Both operations remove all existing partition entries . - MBR is limited to four primary partitions. To exceed four, one primary slot must become an extended partition. Logical partitions inside it are numbered from 5. The extended partition itself cannot store data .
- GPT has no extended/logical distinction. All partitions are primary. The default limit is 128, which is a tool constraint, not a table constraint .
- Boot disk compatibility is determined by firmware. Legacy BIOS requires MBR for the boot disk. UEFI requires GPT. Non-boot data disks can use GPT on any system .
- Swap is a partition type and a formatting decision. The partition type ID (
82in MBR) marks it as swap, but the actual activation requiresmkswapandswapon. The size guidelines in Red Hat documentation are recommendations based on RAM and hibernation, not enforced constraints .
Remember: Partitioning is the first layer of storage abstraction. The partition table tells the firmware and the OS where the partitions are. The partition type tells tools what the partition is intended for. The filesystem or swap signature inside the partition tells the OS how to use it. MBR and GPT are two different ways of recording the first layer, and the choice between them is constrained by disk size and boot firmware. The exam tests the ability to inspect the current table, create the correct type, and recognize when the constraints make one type impossible.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!