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
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 2 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hir Sir
how can i define the Dfine the number of partition that belong to spicific device
How can I know if it has raid setup? and also the cache partition?
Thanks for this! :)