Quick Links

Key Takeaways

  • Partitions are how your storage devices are divided up into pieces.
  • Use fdisk -l, sfdisk -l, df -h, lsblk, lshw, pydf, hwinfo, or parted -l to view your partition table.
  • Run lsblk to get a basic overview of your partitions, or parted -l if you actually need to manipulate them in some way.

Figuring out how drives are partitioned isn't something you'll need to do every day, but it important to be able to do it when the need arises. Here are eight quick ways to do it on Ubuntu.

What is a Partition?

A partition — as the name suggests — is a chunk of space on a drive that has been formatted using one file system or another. All storage, be it a modern NVMe SSD or a legacy hard disk drive, must first be partitioned before it is useable. Most drives have only one partition, though you'll find that most boot drives have small, additional partitions used to store the bootloader or recovery data.

Managing partitions is sometimes necessary if you're troubleshooting, managing operating system installations, or any number of other things. We've focused on Ubuntu here, but these will work in most other Linux distros with only minor tweaking, too.

List Your Partitions with fdisk

Fdisk is technically a program for the creation and management of partitions, however it can also just display them. Open up the Terminal, then run:

sudo fdisk -l

The result of "sudo fdisk -l" in the Terminal.

fdisk is a middle of the road option as far as readability goes. It presents almost everything you would ever need to know, but is still fairly neat and readable. It should be among your first picks if you want a quick partition list.

Use sfdisk to List Partitions

Sfdisk is visually similar to fdisk, and its use is also similar. However, unlike fdisk it is not interactive, and it doesn't handle GPT partitions. It is commonly used when you need to a script that manipulates partitions in some way. To use sfdisk to list your partitions, open Terminal and run:

sudo sfdisk -l

The output of "sudo sfdisk -l"

Use df to View Partition Information

Disk free, most commonly just called "df," is a simple utility to display the disk space of partitions on Linux systems. It is more barebones than most of the other options here, and not ideal if you want detailed information. Run the following in the Terminal:

df -h

The output of df -h is quite minimal.

Use lsblk to Get Information About Partitions

The lsblk utility lists information about storage devices (specifically block devices, thus the name list block) on your system. The command can take a variety of arguments, but the basic lsblk command is great if you just need a quick overview of your system's partitions. Like usual, launch the Terminal and run:

lsblk

The output of lsblk. It is very organized.

Use lshw to Retrieve Information About your Storage Hardware

lshw is a bit like the System Information Panel in Windows, except it is a comand-line tool instead. It provides information about all of the hardware components of your PC, not just the storage devices. As a result, the output tends to be both detailed and cluttered. You're looking for entries labeled *-disk:# and *-volume:#. Open a Terminal, then execute the following command:

lshw

The output of lshw.

Use pydf to List Partitions with Colors

Pydf is an alternative to the basic df command. It does the same things, but is designed to make the output highly customizeable and more readable. Pydf is not installed on most Linux distro by default. First, install Pydf:

sudo apt install pydf

Once the installation has finished, run:

pydf

Make a note of the colors, and how they correspond to different device types.

The colorful output of pydf. Use hwinfo to Find Details About Your Storage Devices and Partition Tables

Hwinfo, or "Hardware Info," is similar to lshw in that it provides information about all of the hardware components in your PC, not just the storage devices and their partition tables. However, there are a few variations of it that can narrow down our results. First, install hwinfo by running:

sudo apt install hwinfo

Once hwinfo is installed, run the following command to get a simplified overview of your partitions:

hwinfo --block --short

The abbreviated output from hwinfo.

If you want more details about your partitions and your physical drives, just omit the --short argument.

hwinfo --block

The full output from Use parted to View and Manage Partitions

Parted is the built-in partition editor on most Linux distros. It is extremely powerful, and worth familiarizing yourself with in general. If you just want the partition editor to display a list of partitions, run the following in the Terminal:

sudo parted -l

Output of "sudo parted -l" in the Terminal.

Use parted with a GUI (gparted)

Parted is primarily a command-line interface (CLI) utility, but it does have a graphical user interface (GUI) as well. The GUI version can be accessed through your normal app drawer on Linux by searching "gparted", or launched through the Terminal. To open it from the Terminal, just run:

sudo gparted

The GUI version of gparted.

You can do everything you normally do with parted, except it has a user interface, too!

Which Utility Should You Use to View Partitions?

There really is no concrete answer here. The commands vary in detail, permission requirements, and functionality, and which you use will depend on what you're doing.

However, we've generally found ourselves using three more than the others, those are:

  • parted (both the CLI and GUI variants)
  • lsblk
  • fdisk

Parted makes the cut because it is such a powerful, versatile tool. lsblk is extremely convenient because it doesn't require elevated permissions to run, which is handy if you're working on a system without sudo access. fdisk is also a decent choice since it is simple to use and presents the desired information succintly.