Master Linux Disk Partitioning with fdisk and parted: Step-by-Step Guide
This tutorial explains how to use Linux's fdisk and parted commands to view, create, modify, and delete disk partitions, covering MBR and GPT limitations, essential command syntax, interactive options, and safety precautions for reliable system administration.
fdisk command
fdisk is a traditional Linux partitioning tool that works with MBR disks but cannot handle partitions larger than 2 TB. Use it to list disks, create partitions, and view partition details. Example commands:
[root@localhost ~]# fdisk -l
# list system partitions
[root@localhost ~]# fdisk /dev/sdx
# create partition on /dev/sdxImportant: never run fdisk on the active system disk, as it can erase the entire system; use a separate disk or a virtual machine.
The partition table output includes seven columns: Device, Boot, Start, End, Blocks, Id, and System. Their meanings are:
Device : partition device file name.
Boot : indicates if the partition is bootable.
Start : starting cylinder.
End : ending cylinder.
Blocks : size in KB.
Id : filesystem identifier (view with “i”).
System : operating system installed on the partition.
Interactive fdisk commands are shown in the following diagram:
parted command
parted works with GPT partition tables and can modify the kernel’s partition table instantly using partprobe, avoiding a reboot. Unlike MBR, GPT supports more than four primary partitions and provides redundancy for safety.
Basic syntax:
[root@localhost omc]# parted [options] <disk> <command>Common operations:
Show partition table: parted /dev/sdc print Create partition: parted /dev/sdc mkpart primary ext3 1 2G (creates a 2 GB ext3 primary partition starting at 1 MB).
Change partition table type: parted /dev/sdc mklabel gpt Delete partition: parted /dev/sdc rm 2 parted also supports checking partitions, resizing, and recovering deleted partitions.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
