Linux for Developers Course
Linux for Developers
/
Intermediate

lsblk

Definition

List Block Devices. A command that prints all available block devices (physical hard drives, SSDs, USBs) in a visual tree format, showing their partitions and mount points.

Explain Like I'm New

Looking at the physical hardware. It shows you the actual physical disks plugged into the computer, regardless of whether they have been mounted into the file system or not.

Real World Example

You buy a new 1TB hard drive and plug it into the server. It doesn't show up in `df` because it isn't mounted. You type `lsblk`. You see `sdb - 1000G` listed. Now you know the OS physically recognizes the new drive.

Common Use Cases

  • •Identifying new hardware
  • •Planning partitions

Interview Questions

basic

  • Does `lsblk` show you how much free space is left on the drive?

intermediate

  • In the output of `lsblk`, what does `sda1` mean compared to `sda`?

Flash Cards

Question

Show free space?

Click to reveal answer
Answer

No. It only shows the absolute total capacity of the physical disk. You must use `df` to see available free space.

Question

sda vs sda1?

Click to reveal answer
Answer

`sda` is the raw, entire physical hard drive. `sda1` is the first logical 'Partition' cut out of that hard drive. A single physical drive can be sliced into multiple partitions (sda1, sda2, sda3).