lsblk Command: How to List Linux Disks and Partitions
Linuxcommands
The lsblk command on Linux displays information about all block devices connected to the system. It is useful for viewing all connected disks whether they are mounted or not.
The most common options are:
- -a, --all Also shows empty devices;
- -d, --nodeps Shows information about the device only, without showing, for example, the partitions;
- -f, --fs Shows detailed information about the filesystems;
Example of usage:
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 64G 0 disk ├─sda1 8:1 0 1G 0 part /mnt└─sda2 8:2 0 63G 0 part ├─cl-root 253:0 0 41G 0 lvm / ├─cl-swap 253:1 0 2G 0 lvm [SWAP] └─cl-home 253:2 0 20G 0 lvm /homesr0 11:0 1 1024M 0 rom
The -d option displays the information without the partitions:
$ lsblk -dNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 64G 0 disk sr0 11:0 1 1024M 0 rom
The -f option can be useful for viewing the UUID of devices:
$ lsblk -fNAME FSTYPE LABEL UUID MOUNTPOINTsda ├─sda1 xfs 1c3b15b1-cd13(...) /mnt└─sda2 LVM2_member GZXwoc-7Ziass(...) ├─cl-root xfs 602fcf7d-d716(...) / ├─cl-swap swap a873901e-5b33(...) [SWAP] └─cl-home xfs fcbdceb1-9053(...) /homesr0
Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, simply log in or create your user here.
Did you like it? Share
That was just one piece. The course teaches the whole path — from your first command to exam day.