Skip to Content

5 Ways to check disk size in Linux

This article is part of the following series.


To check the disk size in Linux, you can use lsblk, fdisk, or parted commands. All these commands are available in most Linux distributions.  They provide information about disk size, partition type, and mount point.

  • lsblk: This command will show you the block devices on your system in a tree-like format.
  • fdisk: This command is used to manipulate disk partitions. 
  • parted: This command is used to create, resize and delete disk partitions.


Related: 3 ways to check disk performance in Linux

Procedure to check disk size in Linux

  • Open the terminal.
  • Type sudo fdisk -l and press Enter.
  • The output will show information about the disk and partitions.
  • Type df -h and press Enter.
  • The output will show the disk partitions and their sizes as well as the amount of free space on each partition.


Related: 2 ways to check disk IOPS in Linux

Understanding Disk Naming standard

In Linux, disks are typically identified and named using a standard naming convention that helps differentiate between different types of disks and their partitions. The common naming standards for disks in Linux are as follows:

  • /dev/hd* – IDE disks. /dev/hda will be the first IDE hard disk, /dev/hdb will be second IDE hard disk, and so on.
  • /dev/sd* – SCSI or SATA disks including SSDs. /dev/sda will be the first SATA/SCSI hard disk, /dev/sdb will be second SATA/SCSI hard disk, and so on.
  • /dev/nvme* – NVM Express (NVMe) pci SSD. /dev/nvme0n1 will be first NVMe SSD, /dev/nvme1n1 will be second NVMe SSD, and so on.


Related: Understanding Disk Partition in Linux – MBR vs GPT

Check disk size with lsblk command in Linux

The best way to check disk size in Linux is using lsblk command. Open the terminal and type lsblk. Then press enter. This will print a list of all the disk devices on your system, as well as their size, type and mount point.

 This command reads the sysfs filesystem and udev db to gather information. 

  • lsblk
  • lsblk /dev/DEVICE
  • lsblk /dev/sda
  • lsblk -l
  • lsblk -d | grep disk


In the following example, there are two disks vda and vdb. The size for vda is 160G. The size for vdb is 3.9T.

$ lsblk
vda 253:0 0 160G 0 disk
|-vda1 253:1 0 1G 0 part /boot
|-vda2 253:2 0 10G 0 part /var/tmp
|-vda3 253:3 0 9G 0 part /var
|-vda4 253:4 0 1K 0 part
|-vda5 253:5 0 6G 0 part /var/log
|-vda6 253:6 0 4G 0 part /home
|-vda7 253:7 0 3G 0 part [SWAP]
|-vda8 253:8 0 512M 0 part /var/log/audit
`-vda9 253:9 0 126.5G 0 part /
vdb 253:16 0 3.9T 0 disk /vdb

  • NAME: Displays the device name.
  • MAJ:MIN: Specifies the major and minor device numbers.
  • RM: Indicates whether the device is removable (0 = not removable, 1 = removable).
  • SIZE: Displays the size of the device.
  • RO: Indicates whether the device is read-only (0 = read-write, 1 = read-only).
  • TYPE: Specifies the device type (e.g., disk, part).
  • MOUNTPOINT: Displays the mount point of the device (if applicable).


In the example output:

  • /dev/vda is a 160GB disk. It has multiple partitions (/dev/vda1, /dev/vda2, etc.), each with a specific size and mount point.
  • /dev/vdb is a 3.9TB disk that is mounted at /vdb.


The output provides an overview of the block devices on your system, their sizes, whether they are read-only or removable, and their associated partitions and mount points.

We can also fine-tune information displayed by lsblk as follows to list only Linux partitions and other data:


Here’s an example of the output:

sda 250G
├─sda1 ext4 100G /
└─sda2 ext4 150G /home
sdb 500G
└─sdb1 ntfs 500G /mnt/data

In this example, the output shows two block devices (sda and sdb) along with their corresponding filesystem types, sizes, and mount points (if applicable).

By customizing the output with specific columns using lsblk -o, you can focus on the relevant information about block devices, such as their names, filesystem types, sizes, and mount points.

The lsblk -f option is used in Linux to display detailed information about block devices and their associated filesystems. It provides an overview of the filesystem type, label, UUID, and mount point (if applicable) for each block device.

Here’s an example of using lsblk -f:

$ lsblk -f
├─sda1 ext4 root 594f7c0c-5e24-4e6b-a3c1-819b573e4407 /
├─sda2 swap 42a6a21f-5e17-4d21-b9d0-685e57ad87f0 [SWAP]
└─sda3 ext4 home d8b4b8e7-aa8b-4d3e-86af-953a1e88c3a9 /home
└─sdb1 ntfs data 23B4227DB42250C5 /mnt/data

In this example, the lsblk -f command provides information about two block devices: sda and sdb.

For sda, it shows three partitions (sda1, sda2, sda3). The FSTYPE column indicates that sda1 and sda3 have an ext4 filesystem, while sda2 is a swap partition. It also displays the LABEL and UUID for each filesystem, along with their corresponding MOUNTPOINT (e.g., /, /home, [SWAP]).

For sdb, it shows a single partition (sdb1) with an NTFS filesystem. It displays the LABEL and UUID for the NTFS filesystem, as well as the MOUNTPOINT (/mnt/data).

By using the lsblk command, you can gather important information about your disks and their partitions, aiding in disk management and understanding the storage configuration of your Linux system.

Related: 4 Ways to Check Disk Partition with Examples in Linux

Check disk size Using fdisk command in Linux

fdisk is a dialog-driven program for creation and manipulation of partition tables. It understands GPT, MBR, Sun, SGI and BSD partition tables.

The -l options shows the partition tables for the specified devices and then exit. If no devices are given, those mentioned in /proc/partitions (if that exists) are used. we can specify device name as follows (in this example list partitions for /dev/sda):

  • fdisk -l /dev/sda
  • fdisk -l


Check disk size with parted command in Linux

Parted is a famous command-line tool that allows us to easily manage hard disk partitions. It can help us add, delete, shrink and extend disk partitions along with the file systems located on them.

Partition Table (GPT) is a standard for the layout of the partition table on a physical hard disk. It is a part of the Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the outdated PC BIOS, one of the few remaining relics of the original IBM PC. EFI uses GPT where BIOS uses a Master Boot Record (MBR).

# parted -l

sudo parted -l
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 150GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

  • Model: Specifies the model or description of the disk, in this case, it’s a VMware Virtual disk (scsi).
  • Disk /dev/sda: Indicates the disk identifier and its name as /dev/sda.
  • 150GB: Displays the size of the disk, which is 150GB.
  • Sector size (logical/physical): Specifies the logical and physical sector size of the disk, both being 512 bytes.
  • Partition Table: msdos: Indicates the partition table type used on the disk, which is MBR (Master Boot Record) or msdos.
  • Disk Flags: Provides any additional flags or attributes associated with the disk.


Number Start End Size Type File system Flags
1 1049kB 1075MB 1074MB primary xfs boot
2 1075MB 150GB 149GB primary lvm

  • Number: Represents the partition number.
  • Start: Indicates the starting position of the partition on the disk.
  • End: Specifies the ending position of the partition.
  • Size: Displays the size of the partition.
  • Type: Specifies the type of the partition (primary, extended, logical, etc.).
  • File system: Indicates the file system type used on the partition (e.g., xfs, ext4, ntfs, etc.).
  • Flags: Provides any specific flags or attributes associated with the partition (e.g., boot, lvm).


Check Disk size Using sfdisk command in Linux

sfdisk command is a partition table editor. It is similar to fdisk and cfdisk, but with additional features.

This is very similar to fdisk, however sfdisk allows us to see both physical and logical volumes and also gives us a “summary” of the actual physical volumes’ partitions with the cylinders (start and end), sectors, size and type.

sfdisk -l device will list the partitions on the specified device. If the device argument is omitted, the partitions on all hard disks are listed. The following example lists the partitions on device /dev/hdc: sfdisk -l /dev/hdc

sudo sfdisk -l
Disk /dev/sda: 140 GiB, 150323855360 bytes, 293601280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xebece6f4
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 293601279 291502080 139G 8e Linux LVM


Check disks with blkid command in Linux

The blkid command in Linux is used to display information about block devices, including disks and partitions, along with their corresponding UUIDs (Universally Unique Identifiers) and other attributes. Here’s how you can use the blkid command to check disks:

Open a terminal and run the following command with root privileges:

$ sudo blkid

The output will display a list of block devices, their UUIDs, filesystem types, and other relevant information. Here’s an example output:

/dev/sda1: UUID="01234567-89ab-cdef-0123-456789abcdef" TYPE="ext4" PARTUUID="12345678-01"
/dev/sda2: UUID="98765432-fedc-ba98-7654-3210fedcba98" TYPE="swap" PARTUUID="12345678-02"
/dev/sdb1: UUID="abcdef01-2345-6789-abcdef012345" TYPE="ntfs" PARTUUID="87654321-01"

In this example, /dev/sda and /dev/sdb are disk devices, and /dev/sda1, /dev/sda2, and /dev/sdb1 are their respective partitions.

The UUID field represents the unique identifier assigned to each disk or partition. It can be used to uniquely identify the disks or partitions, even if their device names change.

Additionally, the TYPE field indicates the filesystem type of each partition, such as ext4, swap, or ntfs.

By using the blkid command, you can obtain important information about the disks and partitions on your Linux system, which can be useful for various administrative tasks and disk management operations.

Prints the block device (partitions and storage media) attributes like uuid and file system type. Does not report the space on the partitions.

  • $ sudo blkid
  • /dev/sda1: UUID=”5E38BE8B38BE6227″ TYPE=”ntfs”
  • /dev/sda5: UUID=”4668484A68483B47″ TYPE=”ntfs”
  • /dev/sda6: UUID=”6fa5a72a-ba26-4588-a103-74bb6b33a763″ TYPE=”ext4″
  • /dev/sda7: UUID=”94443023-34a1-4428-8f65-2fb02e571dae” TYPE=”swap”
  • /dev/sda8: UUID=”13f35f59-f023-4d98-b06f-9dfaebefd6c1″ TYPE=”ext4″
  • /dev/sdb1: UUID=”08D1-8024″ TYPE=”vfat”

Linux command to check disk space

  • df command – Shows the amount of disk space used and available on Linux file systems.
  • du command – Display the amount of disk space used by the specified files and for each subdirectory.