lsblk command on Linux (list block devices) [Basic Guide]

The lsblk command on Linux shows information from all connected block devices in the system. It is useful to view all connected disks whether they are mounted or not.

The most common options are:

  • -a, –all Show empty devices included;
  • -d, –nodeps Shows information from just the device, without showing, for example, the
  • partitions;

  • -f, –fs Shows detailed information about file systems;

Example of use:

$ lsblk 
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
Sda 8:0 0 64G
0 disk ? ?sda1 8:1 0 1G 0 part
/mnt sda2 8:2 0 63G 0 part 496
- cl-root 253:0 0 41 G
0 lvm/
#cl-swap 253:1 0 2G 0 lvm [SWAP] Home

sr0 11:0 1 1024M 0 rom

The -d option shows the information, without the partitions:

$ lsblk -d NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT da 8:0 0 64G 0 disk sr0 11:0 1 1024M 0 rom

The -f option may be useful to view the UUID of the devices:

$ lsblk -f 
NAME FSTYPE LABEL UUID MOUNTPOINT
da
? ?sda1 xfs 1c3b15b1-cd13 (...) /mnt
??sda2 LVM2_member gzxwoc-7ziass (...)
? ?cl-root xfs 602fcf7d-d716 (...) /
496 - cl-swap swap a873901e-5b33 (...) [
SWAP] ??cl-home xfs fcbdceb1-9053 (...) /home

sr0

Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.

Did you like it?

Share

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Need help?