How to list all disks, partitions and sizes on Linux

The purpose of this tutorial is to list all disks, partitions, and their sizes on a Linux system. This will help you identify what hardware storage you have available, how the disks are partitioned, and what sizes each of them are. You will learn a command line and GUI method below.

In this tutorial you will learn:

  • How to list disk information with fdisk and lsblk
  • How to view partitions, sizes, and free space with df
  • How to view disk and partition information with Disks GUI utility
How to list all disks, partitions and sizes on Linux
How to list all disks, partitions and sizes on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software fdisk, lsblk, df, Disks GUI utility
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to list all disks, partitions and sizes on Linux




We will first go over the command line methods that can be used to list hard disk information on Linux. There are multiple available, so you can take your pick on which one you want to use.

  1. The lsblk command will show all storage devices connected to your system, their configured partitions, and the sizes.
    $ lsblk
    

    The screenshot below shows us that we have one hard drive identified as sda, with a size of 50 GB. You can see its partitions and their sizes listed under the disk.

    Running the lsblk command to retrieve hard drive info on Linux
    Running the lsblk command to retrieve hard drive info on Linux
  2. The fdisk command is another way to retrieve the same information.
    $ sudo fdisk -l
    

    The screenshot below shows our hard drive sda and its size. Below that, you can see the partitions, their sizes, and what the partitions are used for (BIOS, Linux filesystem, etc).

    Running the fdisk command to retrieve hard drive info on Linux
    Running the fdisk command to retrieve hard drive info on Linux
  3. The df is a good way to see all the partitions on the system, but it does not list unpartitioned block devices. It will also show the partition size, percentage currently in use, and where the partition is mounted. We recommend using the -h option to put the output in human readable format.
    $ df -h
    
    Retrieving partition information using the df command on Linux
    Retrieving partition information using the df command on Linux

Using GUI Method




All Linux distros and desktop environments should also include a GUI application that can be used to view disk and partition information. In Ubuntu, this utility is simply called “Disks.” This could vary on other distros, but should not be hard to find in the menus.

You can open this utility to see all connected storage devices, their partitions, and sizes.

The Disks utility shows all disk and partition information
The Disks utility shows all disk and partition information

Closing Thoughts

In this tutorial, we saw how to list all disks, partitions, and sizes on a Linux system. There are several command line methods for this, as well as the default GUI utility included with your Linux distro. fdisk can be used to partition your disk if you want to rearrange how your disk storage is configured.



Comments and Discussions
Linux Forum