====== Show Hard Disk Size Linux ======
Sep 2023
\\
==== Overview ====
----
Just a quick note on how to show the entire disk size in Linux, rather than just the partitions.
\\
\\
fdisk -l | grep '^Disk'
\\
==== Example ====
fdisk -l | grep '^Disk'
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 850
Disklabel type: dos
Disk identifier: 0x1f26beb5
Disk /dev/mapper/almalinux-root: 70 GiB, 75161927680 bytes, 146800640 sectors
Disk /dev/mapper/almalinux-swap: 7.79 GiB, 8367636480 bytes, 16343040 sectors
Disk /dev/mapper/almalinux-home: 386.96 GiB, 415500337152 bytes, 811524096 sectors
\\
The first line in the output shows the hard disk size:
\\
\\
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
\\
\\
The remaining three lines are the partitions within that disk:
\\
\\
Disk /dev/mapper/almalinux-root: 70 GiB, 75161927680 bytes, 146800640 sectors
Disk /dev/mapper/almalinux-swap: 7.79 GiB, 8367636480 bytes, 16343040 sectors
Disk /dev/mapper/almalinux-home: 386.96 GiB, 415500337152 bytes, 811524096 sectors.
\\
\\
The three partitions are 70GB + 7.79Gb + 70GB = 464.75GB which is the disk size (all bar 1MB)
\\
\\