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
- How to view partitions, sizes, and free space with
- How to view disk and partition information with Disks GUI utility
|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
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – 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.
lsblkcommand will show all storage devices connected to your system, their configured partitions, and the sizes.
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.
fdiskcommand is another way to retrieve the same information.
$ sudo fdisk -l
The screenshot below shows our hard drive
sdaand its size. Below that, you can see the partitions, their sizes, and what the partitions are used for (BIOS, Linux filesystem, etc).
dfis 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
-hoption to put the output in human readable format.
$ df -h
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.
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.