lsblk Command: Tutorial & Examples
List block devices
lsblk command in Linux displays a list of all block devices, such as hard drives and
their partitions, connected to the machine. It extracts its information directly from
the Linux Kernel. Unlike similar commands like
lsblk provides a tree-like hierarchical structure view of the devices, which is much
easier to understand.
lsblk is crucial for managing storage devices and partitions. It can be used to identify devices and
their partitions, check disk space, and diagnose disk related issues.
lsblk command gathers information from the
sysfs filesystem under
sysfs/block. It lists all block devices and their associated partitions in a tree-like structure, with
the device at the top and its partitions as branches.
Solving Issues with
lsblk can be helpful in several situations. For example, if you're experiencing
a disk space issue, you can use
lsblk to quickly check the sizes of your disks and
It's also handy if you're unsure which device corresponds to a particular disk or partition. The detailed output
lsblk includes the mount points of partitions, which can help you identify the correct
device to work with.
Examples of Using
Here are a few examples of how to use
To list all block devices and partitions in a tree-like structure:
Typical output would look like this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 9G 0 part
│ 253:0 0 6.5G 0 lvm /
253:1 0 2.5G 0 lvm [SWAP]
To list block devices along with their size and file system type:
The output would include additional information:
NAME FSTYPE LABEL UUID MOUNTPOINT
├─sda1 ext4 /boot
│ ext4 /
lsblk command is a powerful tool for managing and diagnosing issues with your storage devices. Its straightforward
output makes it easy to understand the layout of your disks and partitions, and its various options allow you to
customize the information displayed.