Thursday, April 26, 2012

Show Linux Partitions Command

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

No comments:

Post a Comment