Managing disks and partitions using fdisk, parted, and gdisk.

Last Updated : 5 Feb, 2026

Managing disks and partitions is a critical task in Linux system administration. Whether you are installing a new operating system, expanding storage capacity, or reorganizing existing disk layouts, understanding disk partitioning tools is essential. Linux provides several command-line utilities such as fdisk, parted, and gdisk to create, modify, and manage disk partitions efficiently. This guide introduces these tools and explains their basic usage.

1. fdisk:

fdisk is a traditional command-line utility used for disk partitioning. It is simple to use and is commonly employed for managing MBR (Master Boot Record) partition tables. It is best suited for basic partitioning tasks.

Common fdisk Commands:

  • fdisk -l
    Lists all available disks and their partitions.
  • fdisk /dev/sdX
    Starts fdisk for a specific disk (replace X with the appropriate disk letter).

Inside fdisk Interactive Mode:

  • n: Create a new partition
  • d: Delete an existing partition
  • p: Display the partition table
  • w: Write changes to disk and exit

Example:

   fdisk -l
fdisk /dev/sda

2. parted:

parted is a more advanced disk partitioning tool that supports both MBR and GPT partition tables and works well with large disks. It allows partition creation, deletion, resizing, and alignment, making it suitable for modern storage management.

Common parted Commands:

  • parted /dev/sdX: Launches parted for a specific disk.
  • mklabel label-type: Creates a new disk label (e.g., msdos or gpt).
  • mkpart: Creates a new partition.
  • resizepart: Resizes an existing partition.

Example:

   parted /dev/sda
mklabel msdos
mkpart primary ext4 1MiB 100%

3. gdisk:

gdisk is a disk partitioning tool specifically designed for GPT (GUID Partition Table) disks. It is a modern alternative to fdisk and supports very large disks, making it suitable for contemporary systems.

Common gdisk Commands:

  • gdisk /dev/sdX: Starts gdisk for the specified disk.
  • o: Creates a new empty GPT partition table.
  • n: Creates a new partition.
  • p: Displays the current partition table.
  • w: Writes changes to disk and exits.

Example:

   gdisk /dev/sda
o
n
Comment
Article Tags:

Explore