Show Linux Partitions Command

by on February 9, 2010 · 2 comments· LAST UPDATED February 9, 2011

in

How do I display or show a list of all hard disk drive partitions under Linux operating systems?

Your PC or x86 Linux server hard disk drive can be divided into one or more logical disks called partitions. This division is described in the partition table found in sector 0 of the disk. The fdisk command can be used to view the list of the partition tables for the specified devices. Open a command-line terminal (select Applications > Accessories > Terminal), and then type:
$ sudo fdisk -l
OR
# fdisk -l
Sample outputs:

Disk /dev/sda: 73.2 GB, 73284976640 bytes
255 heads, 63 sectors/track, 8909 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1580    12586927+  83  Linux
/dev/sda3            1581        8778    57817935   fd  Linux raid autodetect
/dev/sda4            8779        8909     1052257+   5  Extended
/dev/sda5            8779        8909     1052226   82  Linux swap / Solaris
Disk /dev/sdb: 73.2 GB, 73284976640 bytes
255 heads, 63 sectors/track, 8909 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        7052    56645158+  fd  Linux raid autodetect
Disk /dev/md0: 58.0 GB, 58004537344 bytes
2 heads, 4 sectors/track, 14161264 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md0 doesn't contain a valid partition table

No devices are given, those mentioned in /proc/partitions (if that exists) are used. But you can specify device as follows:
$ sudo fdisk -l /dev/sda
You can also see the list of paritions by typing the following command:
$ cat /proc/partitions
Sample outputs:

major minor  #blocks  name
   8     0   71567360 sda
   8     1     104391 sda1
   8     2   12586927 sda2
   8     3   57817935 sda3
   8     4          1 sda4
   8     5    1052226 sda5
   8    16   71567360 sdb
   8    17   56645158 sdb1
   9     0   56645056 md0
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 2 comments… read them below or add one }

1 ahmad October 8, 2012 at 7:55 pm

Hir Sir
how can i define the Dfine the number of partition that belong to spicific device

Reply

2 Phil November 12, 2013 at 2:34 pm

How can I know if it has raid setup? and also the cache partition?

Thanks for this! :)

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: