How To – Linux List Disk Partitions Command

How do I list all hard disk partitions under a Linux operating systems using the CLI?

Usually, your hard disk drive divided into one or more logical disks called partitions. This division is described in the partition table found in sector 0 of the hard disk. The device is usually /dev/sda, /dev/sdb or so on. A device name refers to the entire disk, and the device name will be as follows:


  1. /dev/hd* – IDE disks. /dev/hda will be first IDE hard disk, /dev/hdb will be second IDE hard disk, and so on.
  2. /dev/sd* – SCSI or SATA disks. /dev/sda will be first SATA/SCSI hard disk, /dev/sdb will be second SATA/SCSI hard disk, and so on.

lsblk Command to list block device on Linux

To list all block devices, run:
# lsblk
Linux list block devices

List Partitions Under Linux

Open a terminal window (select Applications > Accessories > Terminal). Switch to the root user by typing the su - and entering the root password, when prompted by the su command. Or use the sudo command:
$ su -
# fdisk -l

$ sudo fdisk -l
Sample outputs:

Disk /dev/sda: 251.1 GB, 251059544064 bytes
255 heads, 63 sectors/track, 30522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008fcd3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          14      104448   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              14       13068   104857600   83  Linux
/dev/sda3           13068       13198     1048576   82  Linux swap / Solaris
/dev/sda4           13198       30523   139163648    5  Extended
/dev/sda5           13198       30523   139162624   83  Linux

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. You can specify device name as follows (in this example list partitions for /dev/sda):
# fdisk -l

sfdisk Command

The sfdisk command act as a partition table manipulator for Linux. You can use this tool to list partitions too:
# sfdisk -l /dev/sda
# sfdisk -lu /dev/sda
# sfdisk -ls /dev/sda

Sample outputs:


Disk /dev/sda: 8922 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+    104-    105-    838656   83  Linux
/dev/sda2        104+    235-    131-   1048576   82  Linux swap / Solaris
/dev/sda3        235+   8922-   8688-  69781504   83  Linux
/dev/sda4          0       -       0          0    0  Empty


  1. -l : List the partitions of a device.
  2. -s : List the size of a partition.
  3. -u or -uS or -uB or -uC or -uM : Accept or report in units of sectors (blocks, cylinders, megabytes, respecpively). The default is cylinders, at least when the geometry is known.

Listing Linux a Partition Size Larger Than 2TB

The fdisk or sfdisk command will not list any partition size larger than 2TB. To solve this problem you need to use GNU parted command with GPT partitions. It supports Intel EFI/GPT partition tables. 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). In this example list partitions on /dev/sdb using the parted command:
# parted /dev/sdb
Sample outputs:

GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.

Set unit type to TB or GB by typing ‘unit TB‘ or ‘unit GB‘ at the (parted) prompt:
(parted) unit TB
(parted) unit GB
To list partitions type print command at the (parted) prompt:
(parted) print
Sample outputs:

Model: ATA ST33000651AS (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      0.00GB  3001GB  3001GB  ext4         primary


To exit from parted session type ‘quit’ at the (parted) prompt:
(parted) quit

How Do I List All Partitions Layout On All Block Devices?

Pass the -l OR –list option to the parted command to lists partition layout on all block devices:
# parted -l
Sample outputs:

Show Linux Disk Partitions Command

Fig.01: Show Linux Disk Partitions With GNU parted Command

lssci command to list SCSI devices (or hosts) and their attributes

Use the lsscsi command to show SCSI devices (or hosts) and their attributes:
# lsscsi
Sample outputs:

[0:0:0:0]    disk    ATA      TOSHIBA MK5061GS MF00  /dev/sda
[1:0:0:0]    cd/dvd  MATSHITA BD-RE UJ232A     1.10  /dev/sr0
[2:0:0:0]    disk    ATA      ST9500420ASG     0004  /dev/sdb

Here is another outputs:
Linux List Disk Partitions Command


You just learned how to list disk partitions using various Linux commands. For for info see “ls* Commands Are Even More Useful Than You May Have Thought” blog post and man pages by typing the following man command:
man fdisk man sfdisk man lsblk

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

15 comments… add one
  • John Scanlon Apr 6, 2012 @ 18:46

    fdisk -l

    Disk /dev/sda: 145.4 GB, 145492017152 bytes
    255 heads, 63 sectors/track, 17688 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 1 5 40131 de Dell Utility
    /dev/sda2 6 1458 11671222+ 83 Linux
    /dev/sda3 * 1459 1471 104422+ 83 Linux
    /dev/sda4 1472 17688 130263052+ 5 Extended
    /dev/sda5 1472 17688 130263021 8e Linux LVM

  • Sanjith Apr 11, 2012 @ 12:19

    # parted -l

    Model: ST380215A (ide)
    Disk /dev/hda: 80.0GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number Start End Size Type File system Flags
    1 32.3kB 16.8GB 16.8GB primary ext3 boot
    2 16.8GB 32.5GB 15.7GB primary ext3
    3 32.5GB 48.2GB 15.7GB primary ext3
    4 48.2GB 80.0GB 31.8GB extended
    5 48.2GB 60.8GB 12.6GB logical ext3
    6 60.8GB 66.1GB 5239MB logical ext3
    7 66.1GB 71.3GB 5239MB logical linux-swap

  • motorcycles Nov 2, 2012 @ 6:52


    My result is

    ns1-059:~# fdisk -l
    cannot open /proc/partitions

    what wrong?

    • Erathiel May 12, 2014 @ 8:31

      You’re probably missing sudo at the beginning of line ;)

  • daksh21ubuntu Feb 6, 2013 @ 20:01

    it helps me a lot, thank you . . .

  • Jithendra Mar 30, 2013 @ 13:49

    Very informative and nicely written, thanks.

  • mario Aug 5, 2014 @ 9:21

    Hi ,

    I tried parted -l in debian operating system and it is not working as it is not available in the help command option. Please advise. is there any other command that shows all the partitions and the type of the partition on the operating system.

  • Farhan Islam Nov 25, 2014 @ 8:40

    I am unsure but when I did the sfdisk I got this

    sfdisk -lu /dev/sda
    unrecognized format – using sectors

    Disk /dev/sda: 121601 cylinders, 255 heads, 63 sectors/track
    Units = sectors of 512 bytes, counting from 0

    Device Boot Start End #sectors Id System
    /dev/sda1 * 4096 81922047 81917952 83 Linux
    /dev/sda2 81922247 1715951615 1634029369 83 Linux
    start: (c,h,s) expected (1023,254,63) found (1003,108,9)
    end: (c,h,s) expected (1023,254,63) found (317,12,15)
    /dev/sda3 1715951616 1748717551 32765936 82 Linux swap / Solaris
    /dev/sda4 1748717568 1953515519 204797952 83 Linux

    Can anyone tell me how to fix the /dev/sda2 ?

  • zeroday1 Dec 30, 2014 @ 6:49

    How many years have linux installations been plagued by the infamous “No Root File System is Defined” message, whenever a pc user attempts to install Linux or Ubuntu on a hard-drive alongside their Windows installation?!

    This has been going on way too long, for the makers of Linux and Ubuntu to not find a simpler way to facilitate this issue. We all know what the problem is yet, for those of us whom wish to use Linux on the same drive as their Windows OS, literally seem to have no choice but to format the entire drive in order to install Linux, because of some stupid glitch that prevents it recognizing the appropriate partition parameters.

    Of all my experiences with Linux, none of them have ever been with a hard-drive installation but instead only using the LiveCD versions—because I will not remove Windows, just so that I can install Linux on the one Hard drive I have—which is why I want to install Linux alongside Windows.

    The nagging but persistent problem is always the same, “No Root File System is Defined.”

    Even after I extended the system partition and changed the partition id of said system partition (which had over 100GB of unused space), to [ “Linux Native” ] from the drop-down menu of the partition program I was using, it still displayed the same error message above. I tried it with the [ Primary ] option in the Linux installation module, as well as an attempt with the [ Logical ] option——-both of these made no difference and yes, before any nit-picking techies get on my case about it——-I tried the above scenarios with following options:

    First Attempt-

    [ Use As: (Ext 4) and Mount Point: ( / ) ]

    Second Attempt-

    [ Use As: (EFI Boot Partition) ]


    This is what I got after I listed the partition info from the terminal:

    mint@mint ~ $ sudo fdisk -l

    WARNING: GPT (GUID Partition Table) detected on ‘/dev/sda’! The util fdisk doesn’t support GPT. Use GNU Parted.

    Disk /dev/sda: 320.1 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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
    Disk identifier: 0x02ebc2e4

    Device Boot Start End Blocks Id System
    /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
    /dev/sda2 206848 505081855 252437504 7 HPFS/NTFS/exFAT
    /dev/sda3 505083904 625139711 60027904 83 Linux


    When I visited the Ubuntu and Linux support pages which depict a working installation, what displays is a screen-shot of the Linux installation module, at the screen that actually gives the user a choice if they would like to install it with Windows. I was never given that option when I attempted to install Linux Mint 17 or Ubuntu 14.04.1. Both ISO’s provided me with the exact same setup scenario upon installation——-Either I could erase my only hard-drive (which includes my Win7 I want to keep) or (I could attempt to install manually using the partition options). That’s it!

    No option to install with Windows like it showed on the website.

    This is so disconcerting to me that after hours of attempting to install a Linux or Ubuntu platform, neither installation module will recognize the appropriate partition configurations to make a dual-boot (without removing Windows) work.

    Microsoft may definitely be number one at the top of my list of the most frustrating companies in the world, but after enduring this rigmarole to simply install the OS, Linux is definitely not far behind Microsoft when it comes to such improprieties.

    Heck, even Microsoft’s installation of Windows is far simpler than this.

    Linux may have intrigued me time and again, but the more I’ve delved into it’s world, all the more frustrated I became. Really——-how different from Microsoft is Linux, when it’s developers couldn’t even fully automate something as simple as a detect and auto-configuration feature to as to facilitate any type of installation a user might want?!

    After all these years——-and Linux still can’t fix this problem with partition allocation and configuration, except to again dump all this nonsense on the user to try to sort out?!

    It doesn’t matter if it’s free. It’s still marketed as and geared toward users whom want an alternative and even better experience than Windows (even if they still want to keep their Windows installation). Yet the current options available easily put average users in an enormous debacle just to get started with this so-called great Software.

    If its that great——–then why make it extremely difficult to setup?! Us average users in the Windows community already have enough Microsoft headaches to deal with all on their own. You promote a cleaner experience on a faster OS that’s easy to use but fall short of making it a complete package by putting together a very sloppy, at best, installation module, which undoubtedly leaves much to be desired——-to say the least.

    Please fix this problem with the boot-loader/partition/allocation/Root File System Definitions issue. This is an unnecessary road-block which is probably turning away a lot of users whom might otherwise benefit from using this software and whom might actually like it and want to contribute——-but heck!——-if it’s this much trouble just to try to get it installed onto the same drive as my primary OS——-then maybe that’s just one of the reasons why Windows will likely always be my “Primary” choice!

    • JohnM Jan 6, 2015 @ 6:51

      Why not just run your Linux distribution of choice in a VM so that you can tinker around in Linux and still be able to use your windows machine at the same time? I found this to be much easier for me as I get more familiar with linux

    • israel Jan 8, 2015 @ 0:22

      Hi, zeroday1

      I have never had this issue you describe. I have successfuly installed Ubuntu easily for years alongside Windows, and also Mac OSX.
      But I have also installed operating systems before. I have installed DOS, Windows, and (of course) various Linux distros so it may be easier for me to do.

      Installing Ubuntu is much easier and quicker than installing Windows (if you have ever done it) and can detect other OS, unlike Windows, though Mac OSX can detect Windows (usually).

      Installing an OS in a virtual machine would probably suit you better. It is easy to do and will not screw anything up if you make a mistake. If you have a decent processor with vt handling it will run very well. You can also install Ubuntu onto a USB disk, and boot it from your BIOS (if your computer is able to do this).
      If you have you Windows install disks, you can also try installing both in a VM, so you can learn how to do it confidently.

  • Michael Zhou Aug 6, 2015 @ 14:46
    lshw -class disk
  • Ashik Sep 14, 2015 @ 16:33

    Is there any issues to install Redhat Linux 6 in IDE based hard drive machine… When I try to install it on my laptop, its not booting.. Pls help to solve this issue

  • Prema Apr 13, 2016 @ 9:02

    I have doubt in partition. First, I install the os that time itself i partition the hard disk then why we using fdisk command

  • saurabh May 3, 2017 @ 4:13

    sir, there is four partition in my linux os
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:

    Number Start End Size File system Name Flags
    2 1049kB 109GB 109GB ext4 partition 2
    5 109GB 539GB 430GB ntfs Basic data partition msftdata
    6 539GB 749GB 210GB ext4 Basic data partition msftdata
    1 749GB 1000GB 252GB ext4 partition 1
    but in in the file system i am able to see the
    1 749GB 1000GB 252GB ext4 partition 1
    5 109GB 539GB 430GB ntfs Basic data partition msftdata
    and sda 6 and sda2 is unable to see
    how to mount it in file system

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.