Ubuntu: Viewing all available block devices or hard drives, their mount point and their filesystems

 

To list the available hard drives (to be specific, available block devices) we use the following command:

 

lsblk

 

This will provide output in the following format:

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
xvda    202:0    0     8G  0 disk
├─xvda1 202:1    0     7G  0 part /
├─xvda2 202:2    0     1K  0 part
└─xvda5 202:5    0  1022M  0 part [SWAP]

 

If you want to see the filesystems available on these block devices, we use the f flag:

 

sudo lsblk -f

 

If we don’t run this as root it won’t display the filesystems. The output looks like:

 

NAME    FSTYPE LABEL MOUNTPOINT
xvda
├─xvda1 ext4         /
├─xvda2
└─xvda5 swap         [SWAP]

 

There’s quite a bit of information in the above two outputs – we can see the block devices, their partitions, the mount points, the filesystems, their size and whether the partition is marked as readonly or not.

 


Posted

in

,

by