fdisk Command Examples

Partition Table Manipulator for Linux

About fdisk

fdisk (fixed disk or format disk) is a powerful command-line utility for viewing and manipulating disk partition tables on Linux systems. It's one of the most fundamental tools for disk management, allowing system administrators to create, delete, resize, and manage disk partitions. fdisk supports DOS, GPT, SGI, BSD, and Sun partition table formats, making it versatile for various system configurations.

Originally developed for MS-DOS systems, fdisk has been a staple of UNIX and Linux systems since the early days. It operates in an interactive menu-driven mode by default, though modern versions also support command-line scripting.

Critical Warning

fdisk modifies partition tables directly on disk. Incorrect use can result in data loss or system failure. Always backup important data before making partition changes. Many fdisk operations require root privileges and should be executed with extreme caution, especially on production systems.

Example 1: List All Disk Partitions
The most basic and safe fdisk operation is listing all available disks and their partition information. This is a read-only operation that doesn't modify anything on disk.
sudo fdisk -l
Disk /dev/sda: 500 GB, 500107862016 bytes, 976773168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk label type: gpt Disk identifier: A1B2C3D4-E5F6-7890-ABCD-EF1234567890 Device Start End Sectors Size Type /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 975773167 974722544 465G Linux filesystem /dev/sda3 975773168 976773134 999967 488M Linux swap Disk /dev/sdb: 1 TB, 1000204886016 bytes Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x12345678 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 1953525167 1953523120 931G 83 Linux

Understanding the Output:

  • Disk /dev/sda: The physical disk device identifier. /dev/sda is typically the first SATA/SCSI disk
  • Size information: Shows total disk capacity in both bytes and sectors
  • Sector size: Usually 512 bytes (traditional) or 4096 bytes (Advanced Format)
  • Disk label type: Either 'dos' (MBR) or 'gpt' (GUID Partition Table)
  • Partitions: Each partition shows start/end sectors, size, and type
  • EFI System: Boot partition for UEFI systems (typically 512MB)
  • Linux filesystem: Main data partition, usually ext4, xfs, or btrfs
  • Linux swap: Virtual memory swap space
Pro Tip: Use sudo fdisk -l /dev/sda to list partitions for a specific disk only. This is faster and cleaner when working with systems that have many disks.
Example 2: Enter Interactive Mode for a Specific Disk
Interactive mode is where fdisk's real power lies. This example shows how to enter interactive mode and navigate the help system without making any changes.
sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): m Help: DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu u change display/entry units x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table Command (m for help): q

Key Interactive Commands:

  • m: Display the help menu (your best friend in interactive mode)
  • p: Print current partition table (safe, read-only)
  • n: Create a new partition
  • d: Delete a partition
  • t: Change partition type (filesystem identifier)
  • w: Write changes to disk and exit (DANGER: This commits changes!)
  • q: Quit without saving (safe exit)
  • g: Create new GPT partition table (modern, recommended for disks > 2TB)
  • o: Create new DOS/MBR partition table (legacy, limited to 2TB)
Critical Safety Note: Changes are kept in memory until you use the 'w' command. If you make a mistake, just press 'q' to quit without saving. Always verify with 'p' before writing!
Example 3: View Partition Table for a Specific Disk
This shows how to print the partition table for a specific disk in interactive mode. This is useful for examining the current layout before making changes.
sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sda: 500 GB, 500107862016 bytes, 976773168 sectors Disk model: Samsung SSD 860 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: A1B2C3D4-E5F6-7890-ABCD-EF1234567890 Device Start End Sectors Size Type /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 975773167 974722544 465G Linux filesystem /dev/sda3 975773168 976773134 999967 488M Linux swap Command (m for help): q

Interpreting Partition Information:

  • Device: The partition device node (e.g., /dev/sda1)
  • Start/End: Sector numbers where partition begins and ends
  • Sectors: Total number of sectors in the partition
  • Size: Human-readable partition size
  • Type: Partition type identifier (EFI, Linux, swap, etc.)
  • Disk model: Physical disk manufacturer and model information
  • Disklabel type: GPT (modern) or DOS/MBR (legacy)
Calculation Tip: To calculate partition size in GB: (Sectors × 512 bytes) ÷ 1,073,741,824. For /dev/sda2: (974722544 × 512) ÷ 1,073,741,824 ≈ 465 GB.
Example 4: Create a New Primary Partition
This example demonstrates creating a new primary partition on a disk with free space. We'll walk through the complete interactive session.
sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-2097151999, default 2048): [Enter] Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2097151999, default 2097151999): +100G Created a new partition 1 of type 'Linux' and of size 100 GiB. Command (m for help): p Disk /dev/sdb: 1 TB, 1000204886016 bytes Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x87654321 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209717247 209715200 100G 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.

Step-by-Step Breakdown:

  • n command: Initiates new partition creation
  • Partition type: Primary (p) vs Extended (e). Primary partitions are bootable and limited to 4 on MBR disks
  • Partition number: Choose 1-4 for primary partitions
  • First sector: Pressing Enter accepts default (optimal alignment)
  • Last sector: Use +size notation (+100G, +50M, +2T) for human-readable sizes
  • Partition ID 83: Standard Linux filesystem identifier
  • w command: Writes changes to disk (point of no return!)
  • ioctl() call: Kernel notification to re-read partition table
Next Steps: After creating a partition, you need to format it with a filesystem: sudo mkfs.ext4 /dev/sdb1, then mount it: sudo mount /dev/sdb1 /mnt/data
Example 5: Delete a Partition
Deleting a partition removes it from the partition table but doesn't immediately erase the data. This example shows the proper procedure for safe partition deletion.
sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sdb: 1 TB, 1000204886016 bytes Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209717247 209715200 100G 83 Linux /dev/sdb2 209717248 419432447 209715200 100G 83 Linux /dev/sdb3 419432448 629147647 209715200 100G 83 Linux Command (m for help): d Partition number (1-3, default 3): 2 Partition 2 has been deleted. Command (m for help): p Disk /dev/sdb: 1 TB, 1000204886016 bytes Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209717247 209715200 100G 83 Linux /dev/sdb3 419432448 629147647 209715200 100G 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.

Important Considerations:

  • Unmount first: Always unmount the partition before deletion: sudo umount /dev/sdb2
  • Data recovery: Deleted partition data may be recoverable until overwritten
  • Partition numbering: After deletion, partition numbers don't automatically renumber
  • Free space: Deleted partition becomes free space available for new partitions
  • Boot issues: Deleting wrong partition can make system unbootable
  • fstab entries: Remove or comment out /etc/fstab entries for deleted partitions
  • LVM/RAID: Check if partition is part of LVM volume group or RAID array first
Safety Protocol: Before deleting, verify data is backed up, check mount status with mount | grep sdb2, and verify nothing is using it with sudo lsof /dev/sdb2.
Example 6: Change Partition Type
Partition types (IDs) tell the operating system what kind of filesystem or data the partition contains. This example shows how to change a partition from Linux filesystem to Linux swap.
sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209717247 209715200 100G 83 Linux Command (m for help): t Selected partition 1 Hex code or alias (type L to list all): L 00 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris 01 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- 02 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- 03 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT- 04 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx 05 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data 06 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . 07 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility 08 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt 09 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access 0a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O 0b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor 0c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Linux extended 0e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs 0f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT 10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ 11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b 12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor 16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto 1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep 1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT Hex code or alias (type L to list all): 82 Changed type of partition 'Linux' to 'Linux swap / Solaris'. Command (m for help): p Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209717247 209715200 100G 82 Linux swap / Solaris Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.

Common Partition Type Codes:

  • 82: Linux swap / Solaris - Virtual memory swap partition
  • 83: Linux - Standard Linux filesystem (ext2/3/4, xfs, btrfs, etc.)
  • 8e: Linux LVM - Physical volume for Logical Volume Manager
  • fd: Linux raid autodetect - Software RAID partition
  • ef: EFI System - Boot partition for UEFI systems
  • 07: HPFS/NTFS/exFAT - Windows filesystems
  • 0b/0c: W95 FAT32 - Windows FAT32 filesystem
  • a5: FreeBSD - FreeBSD partition
Important Note: Changing the partition type ID doesn't change the actual filesystem! You still need to format: sudo mkswap /dev/sdb1 then sudo swapon /dev/sdb1 for swap.
Example 7: Create GPT Partition Table on New Disk
GPT (GUID Partition Table) is the modern standard for partitioning, supporting disks larger than 2TB and up to 128 partitions. This example shows initializing a new disk with GPT.
sudo fdisk /dev/sdc
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x12345678. Command (m for help): g Created a new GPT disklabel (GUID: 9A8B7C6D-5E4F-3210-ABCD-1234567890AB). Command (m for help): n Partition number (1-128, default 1): 1 First sector (2048-3907029134, default 2048): [Enter] Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-3907029134, default 3907029134): [Enter] Created a new partition 1 of type 'Linux filesystem' and of size 1.8 TiB. Command (m for help): p Disk /dev/sdc: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors Disk model: WDC WD20EZRX-00D Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 9A8B7C6D-5E4F-3210-ABCD-1234567890AB Device Start End Sectors Size Type /dev/sdc1 2048 3907029134 3907027087 1.8T Linux filesystem Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.

GPT vs MBR/DOS:

  • Disk size limit: MBR max 2TB, GPT supports up to 9.4ZB (zettabytes)
  • Partition count: MBR limited to 4 primary (or 3 primary + extended), GPT supports 128 partitions
  • Data protection: GPT stores multiple copies of partition data for redundancy
  • CRC checksums: GPT uses checksums to detect corruption
  • UEFI requirement: Modern UEFI systems require GPT for boot drives
  • Unique GUIDs: Each partition has globally unique identifier
  • Partition names: GPT allows human-readable partition names (36 characters)
  • Backwards compatibility: GPT includes protective MBR to prevent old tools from damaging disk
Best Practice: Use GPT for all new disks, especially those over 2TB. Use 'g' command in fdisk or specify GPT during installation. MBR should only be used for legacy systems or specific compatibility requirements.
Example 8: List Free Space on Disk
Before creating new partitions, it's helpful to see exactly how much free space is available and where it's located on the disk. The 'F' command displays unpartitioned space.
sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): F Unpartitioned space /dev/sdb: 731.52 GiB, 785426604032 bytes, 1534239616 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes Start End Sectors Size 629147648 2097151999 1468004352 699.8G 2097152000 2163486719 66334720 31.6G Command (m for help): p Disk /dev/sdb: 1 TB, 1000204886016 bytes Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes Disklabel type: dos Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209717247 209715200 100G 83 Linux /dev/sdb3 419432448 629147647 209715200 100G 83 Linux Command (m for help): q

Understanding Free Space:

  • Fragmented space: Multiple non-contiguous free space regions shown separately
  • Sector ranges: Start and End sectors define exact location of free space
  • Gap after sdb1: Space between partition 1 and 3 (209717248-419432447)
  • End of disk: Space after last partition to end of disk
  • Alignment considerations: Some space may be reserved for proper sector alignment
  • Total calculation: Sum all free space regions for total available space
  • Planning partitions: Use this info to determine optimal partition sizes
  • Defragmentation: Consider reorganizing partitions to consolidate free space if needed
Strategy Tip: When creating multiple partitions, consider leaving some free space unallocated for future flexibility. You can always expand into free space later, but shrinking partitions is risky.
Example 9: Display Detailed Partition Information
The 'i' command provides comprehensive information about a specific partition, including UUID, type codes, and other technical details useful for troubleshooting and system configuration.
sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): i Partition number (1-3, default 3): 2 Device: /dev/sda2 Start: 1050624 End: 975773167 Sectors: 974722544 Size: 465G Type: Linux filesystem Type-UUID: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 UUID: 7B8A9C0D-1E2F-3A4B-5C6D-7E8F9A0B1C2D Partition GUID: E3A2B1C0-9F8E-7D6C-5B4A-3F2E1D0C9B8A Command (m for help): i Partition number (1-3, default 3): 1 Device: /dev/sda1 Start: 2048 End: 1050623 Sectors: 1048576 Size: 512M Type: EFI System Type-UUID: C12A7328-F81F-11D2-BA4B-00A0C93EC93B UUID: A1B2C3D4-E5F6-7890-ABCD-EF1234567890 Partition GUID: 12345678-90AB-CDEF-1234-567890ABCDEF Command (m for help): q

Key Information Fields:

  • Device: Full partition device path
  • Start/End: Exact sector boundaries of partition
  • Sectors: Total sector count (multiply by 512 for bytes)
  • Size: Human-readable partition size
  • Type: Descriptive partition type name
  • Type-UUID: GPT partition type identifier (standardized across systems)
  • UUID: Unique filesystem identifier (used in /etc/fstab with UUID=...)
  • Partition GUID: Globally unique partition identifier
UUID Usage: The UUID field is critical for /etc/fstab entries. Use UUID=7B8A9C0D-1E2F-3A4B-5C6D-7E8F9A0B1C2D instead of /dev/sda2 for reliable mounting that survives disk reordering.
Example 10: Expert Mode - View Partition Alignment
Expert mode (x) provides advanced features including alignment verification. Proper partition alignment is critical for optimal SSD and Advanced Format HDD performance.
sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): x Expert command (m for help): m Help (expert commands): Misc M print this menu Get d print the raw data of the first sector from the device D print the raw data of the disklabel from the device e list extended partitions f fix partitions order i change disk guid l list known partition types Save & Exit r return to main menu w write table to disk and exit q quit without saving changes Expert command (m for help): f Nothing to do. Ordering is correct already. Expert command (m for help): r Command (m for help): v Partition 1: device /dev/sda1 contains ext4 signature. Partition 2: device /dev/sda2 contains ext4 signature. Partition 3: device /dev/sda3 contains swap signature. Remaining 33 sectors unused. Command (m for help): q

Expert Mode Features:

  • x command: Enter expert mode for advanced operations
  • f command: Fix partition ordering (sorts partition table entries)
  • r command: Return to main menu from expert mode
  • v command: Verify partition table consistency and alignment
  • i command: Change disk GUID (GPT only)
  • d/D commands: Display raw sector data for debugging
  • Unused sectors: Small amount of space reserved for alignment and metadata
  • Signature detection: Verification shows existing filesystems on partitions
Alignment Check: For SSDs and AF HDDs, partitions should start on 4K (8 sector) boundaries. Default fdisk settings handle this automatically. Check with sudo parted /dev/sda align-check optimal 1.

Additional fdisk Information

📋 MBR vs GPT: Choosing the Right Format

Master Boot Record (MBR/DOS):

  • Maximum disk size: 2 TiB (2,199,023,255,552 bytes)
  • Maximum 4 primary partitions OR 3 primary + 1 extended (with unlimited logical partitions)
  • Used by BIOS firmware systems
  • Partition table stored in first sector (LBA 0)
  • No redundancy - single point of failure
  • Legacy standard, still compatible with all systems

GUID Partition Table (GPT):

  • Supports disks up to 9.4 ZiB (9,444,732,965,739,290,427,392 bytes)
  • Up to 128 partitions by default (can be more)
  • Required for UEFI boot on modern systems
  • Multiple copies of partition data for redundancy
  • CRC32 checksums for corruption detection
  • Each partition has a unique GUID
  • Protective MBR prevents old tools from destroying GPT data

🔧 Common fdisk Workflows

Adding a New Disk to System:

  1. Identify disk: sudo fdisk -l
  2. Create partition table: sudo fdisk /dev/sdX → 'g' (GPT) or 'o' (MBR)
  3. Create partitions: 'n' command, specify sizes
  4. Set types if needed: 't' command
  5. Write changes: 'w' command
  6. Create filesystems: sudo mkfs.ext4 /dev/sdX1
  7. Mount: sudo mount /dev/sdX1 /mnt/point
  8. Add to fstab: Edit /etc/fstab with UUID for persistent mounting

Expanding Existing Partition:

  1. Backup all data first!
  2. Delete the partition: 'd' command (data remains intact)
  3. Recreate with same start sector but larger end sector
  4. Write changes: 'w'
  5. Reboot or use partprobe to update kernel
  6. Resize filesystem: sudo resize2fs /dev/sdX1 (ext4) or sudo xfs_growfs /mount/point (XFS)

⚡ Performance Considerations

Partition Alignment: Modern storage devices use 4K sectors (Advanced Format). Partitions should start on 4K boundaries (sector numbers divisible by 8). fdisk handles this automatically with default values starting at sector 2048.

SSD Optimization: For SSDs, ensure TRIM is enabled. Add 'discard' option in /etc/fstab or run fstrim periodically. Partition alignment is especially critical for SSD performance.

RAID Considerations: When creating partitions for software RAID, set type to 'fd' (Linux raid autodetect). Ensure all RAID members have identical partition layouts.

🛡️ Safety Best Practices

  • Always backup: Before any partition operation, backup critical data
  • Verify device: Triple-check you're operating on the correct disk (fdisk -l)
  • Unmount first: Unmount all partitions before modifying them
  • Check dependencies: Verify partition isn't used by LVM, RAID, or dm-crypt
  • Document current state: Save partition table: sudo sfdisk -d /dev/sda > sda-backup.txt
  • Test in VM: Practice complex operations in virtual machine first
  • Use 'p' frequently: Review changes before writing with 'w'
  • Understand 'w' is permanent: Once written, changes are immediately applied
  • Keep rescue media: Have bootable USB ready for recovery

🔍 Related Commands

Command Purpose Example
parted Alternative partition editor with more features sudo parted /dev/sda print
gdisk GPT-focused fdisk alternative sudo gdisk /dev/sda
cfdisk Curses-based fdisk with TUI interface sudo cfdisk /dev/sda
sfdisk Scriptable partition table manipulator sudo sfdisk -d /dev/sda
partprobe Inform kernel of partition table changes sudo partprobe /dev/sda
lsblk List block devices and partitions lsblk -f
blkid Display block device attributes including UUIDs sudo blkid /dev/sda1

💡 Troubleshooting Common Issues

Problem: "Device or resource busy"

Solution: Partition is mounted or in use. Check with mount | grep sdX and lsof /dev/sdX1, then unmount.

Problem: Changes not reflected after 'w'

Solution: Kernel may not have re-read partition table. Run sudo partprobe /dev/sdX or reboot system.

Problem: "Partition doesn't end on cylinder boundary"

Solution: This warning is obsolete for modern disks. It referred to ancient CHS (Cylinder-Head-Sector) addressing. Safely ignore on modern systems.

Problem: Can't delete partition

Solution: Partition may be in use by LVM, RAID, or mounted. Check pvdisplay, cat /proc/mdstat, and mount.

Problem: "GPT PMBR size mismatch" error

Solution: GPT protective MBR doesn't match disk size (common after cloning to larger disk). Fix with sudo gdisk /dev/sdX → 'x' → 'e' → 'w'.

📚 Historical Context

fdisk has been a fundamental UNIX/Linux tool since the early 1980s. Originally developed for DOS systems, it was adopted by Linux and has evolved significantly over the decades. The transition from MBR to GPT partition tables represents one of the most significant changes in disk management in the past 40 years, driven by increasing disk capacities and the need for more robust data protection. Modern fdisk (util-linux 2.x) seamlessly handles both legacy MBR and modern GPT formats, making it an essential tool that bridges four decades of computing history.