5 Disk Partitioning Tools for Linux and When to Use Each One

5 Disk Partitioning Tools for Linux and When to Use Each One

Disk partitioning tools on Linux all edit the same structure, a table that records which sectors belong to which partition. The trouble usually sits one layer below, where a partition entry and the filesystem inside it hold separate sizes.

What those tools will do for you comes down to two rules. Unallocated space has to sit next to the partition you want to grow, and a filesystem that is mounted cannot be reshaped from the system running on it.

A partition entry and a filesystem are two different sizes

A partitioned disk carries two separate structures. A partition entry is a range of sectors with a type code, and the filesystem inside it keeps its own block count, inode count and journal. Partitions and filesystems cover that split in more detail.

I wrote a GPT label onto a 512 MiB image file and added one partition.

parted prints the entry, and the File system column is empty because nothing has been formatted there yet.

fallocate -l 512M demo-table.img
sudo parted demo-table.img mklabel gpt
sudo parted demo-table.img mkpart primary ext4 1MiB 200MiB
sudo parted demo-table.img print
parted print output for a 512 MiB test image showing one 209 MB partition with an empty File system column
parted prints the table entry, and the File system column stays empty until something is formatted

I checked blkid on the same file, and it reports nothing but the table type. That missing TYPE line is what the filesystem layer looks like before mkfs has run.

$ blkid demo-table.img
demo-table.img: PTUUID="ca39cb1d-9943-4865-932f-7d92adfd4335" PTTYPE="gpt"

Widening the entry does not move the filesystem, because the two structures are independent. parted resizepart took the same partition from 209 MiB to 314 MiB, and the File system column stayed empty after it.

sudo parted demo-table.img resizepart 1 300MiB
sudo parted demo-table.img print

Only a filesystem tool moves that inner boundary, and it has to run after the table entry has grown. GParted and GNU Parted call resize2fs or xfs_growfs for you when they can reach the filesystem, and the closing section here runs the same commands by hand.

StructureWhat it storesWhat changes it
Partition table entrystart sector, end sector, type code, flagsparted, fdisk, sgdisk, GParted
Filesystemblock count, block size, inode count, journalmkfs at creation, then resize2fs or xfs_growfs
Mountthe directory tree the filesystem appears atmount and umount

What to check before you touch a disk

Identify the exact block device first, because /dev/sda and /dev/sda2 are different objects and every tool here accepts both. lsblk on the disk prints each partition with its size and mount point in one view.

$ lsblk /dev/sda
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda       8:0    0  100G  0 disk
├─sda1    8:1    0   99G  0 part /
├─sda15 8:15    0   99M  0 part /boot/efi
└─sda16 259:0    0  923M  0 part /boot
lsblk output for /dev/sda listing sda1, sda15 and sda16 with sizes and mount points
lsblk lists every partition on the disk with its size and mount point

Before any write, four things decide whether it will work.

  • The free space is adjacent to the partition you are growing. Space on the far side of another partition is unusable until that partition moves out of the way.
  • Nothing on the disk is mounted, swap partitions included. A busy device refuses the change, and GParted refuses a mounted filesystem before it tries.
  • The filesystem is clean. resize2fs stops on a dirty ext4 volume and asks for e2fsck first.
  • Anything you plan to shrink has a copy. dd on the partition rather than the disk writes one you can put back.

I copied a 923 MiB ext4 partition into an image file and timed the copy at 29 seconds, about 34 MB per second.

When the partition you need to change holds the running root filesystem, no tool can reshape it from inside that system, and the work moves to live media. GParted ships a Live image for exactly that job, and a bootable USB is how you get there. Knowing the df command output first tells you whether the space you need is already free inside the filesystem.

Graphical partitioning tools

All three of these draw the disk as a row of partitions, which is the quickest way to see where the free space sits. They do the same core work, and they differ in their dependencies and their extra tools.

GParted

GParted is the GNOME partition editor, packaged as gparted, and it is version 1.5.0 on Ubuntu 24.04.

sudo apt install gparted        # Debian, Ubuntu
sudo dnf install gparted        # Fedora
sudo pacman -S gparted          # Arch Linux

I opened the test image in GParted 1.5.0, which takes a device path or an image file and lists whatever it finds in a table. The partition I created without a filesystem showed up as unknown there, next to the one holding a FAT32 filesystem.

GParted 1.5.0 showing a test image with a FAT32 partition and a second partition listed as unknown
GParted 1.5.0 on a scratch image, where the partition without a filesystem is listed as unknown

Launch GParted with sudo from a terminal, since a desktop launcher with no polkit agent running fails with Error executing command as another user.

GParted stops at two boundaries, one about mount state and one about where the system runs from. It will not change a mounted partition, and it cannot reshape the filesystem the running system sits on, which is the job the Live image exists for.

KDE Partition Manager

KDE Partition Manager is packaged as partitionmanager on Debian and Ubuntu, at 23.08.5 in noble, and as kde-partitionmanager on Fedora.

sudo apt install partitionmanager      # Debian, Ubuntu
sudo dnf install kde-partitionmanager  # Fedora
sudo pacman -S partitionmanager        # Arch Linux

I checked the package list for Ubuntu and the older name fails outright there. Installing kde-partitionmanager returns E: Unable to locate package, and a reader following an older guide gets that line and nothing else.

KDE Partition Manager window showing the device list and the partition actions toolbar
KDE Partition Manager, from the application’s official screenshot

Its partition view carries the same resize, move, copy and delete actions as GParted, with the KDE stack underneath it.

GNOME Disks

Disks is the GNOME tool, packaged as gnome-disk-utility and installed by default on Ubuntu’s desktop. I installed the package and found the binary at /usr/bin/gnome-disks, which is why the menu entry and the package name never match.

sudo apt install gnome-disk-utility      # Debian, Ubuntu
sudo dnf install gnome-disk-utility      # Fedora
sudo pacman -S gnome-disk-utility        # Arch Linux

This package name catches more readers than the others, because the install command in circulation is baobab. That package is Disk Usage Analyzer, which reports folder sizes and cannot create or resize a partition at all. Once Disks is running, the filesystem of an unmounted partition is one click away in its volume panel.

GNOME Disks showing disk space allocation and volumes
GNOME Disks, from the application’s official screenshot

Disks also writes a disk image to a device, restores a partitioned image, benchmarks read and write speed, and reports drive health where the hardware exposes it.

Command-line partitioning tools

A server has no display to open, and a script cannot click Apply. The two tools below ship in the base system on every mainstream distribution.

fdisk

fdisk edits the table in a menu-driven session, and it reads a device or an image file.

$ fdisk -l demo-table.img
Disk demo-table.img: 512 MiB, 536870912 bytes, 1048576 sectors
Units: sectors of 1 * 512 = 512 bytes
Disklabel type: gpt
Disk identifier: 7776F096-8590-44A5-9738-22C561E99524

Device         Start    End Sectors  Size Type
demo-table.img1 2048 409599  407552  199M Linux filesystem

Nothing is written until you say so, because the session edits an in-memory copy of the table and only the exit key decides what happens to it.

KeyWhat it does
pprints the current table without leaving the session
nstarts a new partition and asks for its first and last sector
ddeletes the partition whose number you give it
tchanges the type code of an existing entry
wwrites the table to disk and exits
qquits and leaves the disk untouched

fdisk understands GPT, MBR, Sun, SGI and BSD partition tables according to its own manual, so a modern GPT disk does not need a separate front end. Where every sector matters, sgdisk is the tool that works on GPT alone.

GNU Parted

parted takes the operation as an argument instead of a menu, which is what makes it scriptable.

sudo parted demo-table.img resizepart 1 300MiB
sudo parted demo-table.img print

The size argument accepts units and the keyword 100%, so growing a partition into the rest of the free space needs no arithmetic. It also accepts a start and end pair when you create an entry with mkpart.

resizepart changes the table entry alone. The filesystem keeps its old size until a second command grows it, which is the step that decides whether df reports the new size.

Which one to open

The deciding question is where the partition lives and what else the machine has to do at the same time.

Your jobToolWhy
See the layout and resize a partition you are not running fromGParteddraws the table and calls the filesystem tools for you
Resize the disk the system boots fromGParted Live from a USB sticknothing can reshape the running root filesystem in place
Work on a server over SSHGNU Parted or fdisk, then resize2fsno display needed, and the whole sequence fits in a script
Change one entry with exact controlfdisk, or sgdisk for GPT worksector-level edits with a confirmation step before any write
A quick job on a stock GNOME desktopGNOME Disksalready installed, no extra packages
A GUI on a KDE systemKDE Partition Managerthe same actions as GParted on the Qt stack

None of the five is a wrong answer, and the layout rule decides more outcomes than the choice of tool does. An encrypted volume adds one more step, since the mapping has to be open before anything inside it can be resized, which the LUKS guide covers.

When the resize option is greyed out

Nearly every refused or unavailable resize comes down to one of four causes, and each has a different fix.

What you seeCauseWhat to do
Resize is greyed out, and free space sits elsewhere on the diskthe unallocated space is not adjacent, another partition sits between themmove the partition in the way, which copies every sector inside it
GParted reports a mounted volumea filesystem on that disk is mountedunmount it, or run from live media when it holds the root filesystem
The resize fails part way throughthe device is busy, often a swap partition or an open mountrun swapoff on it and close anything holding the device
The shrink option is missing for one filesystemXFS grows online and has no shrink pathcopy the data out, create the filesystem again and restore

The move case carries its own warning dialog, which reads Moving a partition might cause your operating system to fail to boot. That is accurate rather than dramatic, because the operation rewrites the identifiers a bootloader and fstab look for, and a grub rescue prompt is where that ends when the identifiers move.

sudo partprobe /dev/sda
# no output means the kernel re-read the table successfully

A fresh partition can also stay invisible until the kernel reads the table again, so partprobe asks for that re-read and a reboot does it as a side effect.

Grow the table entry first, then the filesystem

I ran the full sequence against a copy of an ext4 partition to get the numbers below. The order is fixed, because a filesystem can only grow into space its partition already covers.

sudo parted /dev/sdX resizepart 2 100%
sudo e2fsck -f /dev/sdX2
sudo resize2fs /dev/sdX2

On the image I used, resize2fs took the filesystem from 236288 blocks of 4 KiB to 384000 blocks, which is the difference between a 923 MB volume and a 1.5 GB one.

resize2fs output reporting that the filesystem is now 384000 4k blocks long
resize2fs reports the new block count after the filesystem has grown

I ran e2fsck before the resize, because resize2fs answers Please run e2fsck -f first and stops before touching anything without it.

I ran the same command a second time and it refused with The filesystem is already 384000 (4k) blocks long. Nothing to do!, which is the state you want to end in. Filesystem choice matters here too, since ext4 against Btrfs decides which resize tools exist at all.

Growing the entry alone leaves the filesystem exactly where it was, and df keeps reporting the old size until the second command runs.

Common questions

Which disk partitioning tool should I use on Linux?

GParted if you want to see the disk and work with a mouse, GNU Parted or fdisk if you are working over SSH or writing a script. Use live media when the partition you need to change holds the system you are running.

Why is the resize option greyed out in GParted?

The free space is usually not next to the partition you selected, or a filesystem on that disk is still mounted. GParted greys out an action it cannot complete instead of failing part way through it.

What is the difference between a partition and a filesystem?

A partition is a range of sectors recorded in the partition table. The filesystem is built inside that range by mkfs and carries its own size, which is why both layers have to be grown separately.

Can I resize the partition my system is running from?

Not from inside that system, because the root filesystem is mounted while it is in use. The work happens from a live USB, which is what the GParted Live image provides.

Does XFS support shrinking?

No. xfs_growfs grows a mounted XFS filesystem and there is no shrink equivalent, so a smaller volume means backing the data up, creating the filesystem again and restoring.