Egemen
Korkmaz
jan 17, 2023

Ubuntu how to check hard disk size

Run the df -h command to get the availaible space in your system

df -h

The above command will give you the output like this

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.7G  7.7G     0 100% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G  4.0K  3.9G   1% /dev/shm
tmpfs           795M   79M  717M  10% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup

In the above output you can see that that disk size is around 8 GB.

Run the lsblk command to list the information about all the available block devices on the disk

lsblk

The above command will give you the output like this

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop4     7:4    0 61.9M  1 loop /snap/core20/1405
loop5     7:5    0 61.9M  1 loop /snap/core20/1242
loop6     7:6    0 43.6M  1 loop /snap/snapd/15177
loop7     7:7    0 55.5M  1 loop /snap/core18/2253
loop8     7:8    0 55.5M  1 loop /snap/core18/2344
xvda    202:0    0    8G  0 disk 
└─xvda1 202:1    0    8G  0 part /

The last two lines will give you the indicator of the hard disk size on your Ubuntu instance. In the above case it is 8GB.