Disk Partitioning with fdisk and parted
Learn how to create, modify, and manage disk partitions using fdisk and parted, including MBR and GPT partition tables, partition flags, and partition verification.
Overview
In this lab, you will learn how to manage disk partitions using fdisk and parted in a safe practice environment. You will create virtual disk images, attach them as loop devices, and practice creating and deleting partitions using both MBR and GPT partition tables. You will also learn how to create an EFI System Partition, set partition flags, inspect partition layouts in different formats, and verify block device information using Linux storage utilities. By the end of this lab, you will understand the fundamental partitioning operations required for Linux system administration.
Learning Outcomes
- Create virtual disk images and attach them as loop devices.
- Inspect disk and partition information using
fdisk. - Create and manage MBR partition tables and primary partitions.
- Create and manage GPT partition tables using
parted. - Refresh kernel partition information and identify partition devices.
- Display partition layouts using human-readable and machine-readable output.
- Inspect block devices and filesystem signatures using
lsblkandblkid.
Key Concepts
- Disk Partitioning: Divides a disk into separate logical sections that can be managed independently.
- fdisk: A command-line utility used to create and manage disk partition tables, including MBR and GPT.
- parted: A partitioning utility that supports creating, modifying, deleting, and inspecting disk partitions.
- MBR Partition Table: A traditional partitioning scheme that supports up to four primary partition entries, with extended and logical partitions available to work around this limit.
- GPT Partition Table: A modern partitioning scheme that supports large disks and more partition entries than traditional MBR.
- Loop Device: A virtual block device that allows a regular file to be accessed like a disk for testing and practice.
- EFI System Partition (ESP): A partition used by UEFI firmware to store bootloader files. Setting the ESP flag does not format the partition.
- Partition Scanning: Allows the kernel to recognize newly created partitions and expose their device nodes.
- lsblk and blkid: Utilities for inspecting block device layouts and identifying recognized filesystem signatures.
Why Needed?
- Storage Management: Enables administrators to divide disks into partitions for different storage and system requirements.
- Boot Configuration: Provides practical experience with GPT partitioning and EFI System Partition flags used in UEFI-based systems.
- Safe Practice: Uses virtual disk images and loop devices to practice partitioning without intentionally modifying live system disks.
- Troubleshooting: Develops the ability to inspect partition tables, identify block devices, and verify partition changes.
- LFCS Preparation: Builds practical command-line skills for Linux storage administration and partition management.