lsblk

On this page 7

lsblk is a Linux command-line utility that lists block devices, such as disks, partitions, logical volumes and loop devices, and shows how they relate to one another in a tree view. In filesystem administration, it is usually the first command an administrator runs to answer a basic question: which storage devices exist, how large they are and where they are mounted.

The tool is part of the util-linux package, so it is present on virtually every Linux distribution. It reads information from sysfs and the udev database rather than probing the disks directly, which makes it fast, safe to run and usable without root privileges for most columns.

How lsblk gathers block device information

A block device is a storage device that the kernel accesses in fixed-size blocks, such as an SSD, an NVMe namespace, a USB stick or a device-mapper volume. The kernel publishes each one under `/sys/block` and /sys/dev/block, together with attributes such as size, rotational flag and the list of holders and slaves.

lsblk walks this sysfs hierarchy and builds the parent-child relationships: a partition is a child of its disk, a LUKS mapping is a child of its partition, and an LVM logical volume is a child of the physical volume beneath it. Filesystem labels, UUIDs and types come from the udev database or, when that is unavailable, from libblkid. Mount points are read from `/proc/self/mountinfo`.

Because the command does not open the devices themselves, it neither wakes sleeping disks for most columns nor risks modifying data. The trade-off is that its view is only as current as udev: on a freshly attached device, some fields may appear empty until udev finishes processing the event.

The table below lists the data sources and what each contributes to the output.

SourceInformation providedNote
sysfsDevice names, sizes, hierarchy, rotational flagAlways available on a running kernel
udev databaseFilesystem type, label, UUID, model, serialMay lag behind hot-plug events
libblkidFilesystem signatures as a fallbackNeeds read access to the device
mountinfoCurrent mount pointsReflects the caller’s mount namespace
Where lsblk takes its data from

Output columns and useful options

By default, lsblk prints seven columns: NAME, MAJ:MIN, RM, SIZE, RO, TYPE and MOUNTPOINTS. The TYPE column distinguishes disk, part, lvm, crypt, loop and rom, which immediately shows how a storage stack is assembled.

The following table explains the columns that administrators request most often with the `-o` option.

ColumnMeaningTypical value
NAMEKernel device name in tree formnvme0n1p2
SIZECapacity in binary units476.9G
TYPEKind of block devicedisk, part, lvm, crypt
FSTYPEFilesystem or signature typeext4, xfs, LVM2_member
UUIDFilesystem UUID used in fstab36-character identifier
MOUNTPOINTSAll current mount locations/, /home, [SWAP]
ROTARotational device flag1 for HDD, 0 for SSD
MODELDevice model stringVendor model name
Commonly selected lsblk columns

Several options change the format rather than the content. `-f` shows filesystem details, `-p` prints full paths such as /dev/sda1, `-J` produces JSON, `-P` produces key-value pairs, and `-b` reports sizes in bytes. For scripts, the combination `lsblk -J -b -o NAME,SIZE,TYPE` gives stable, machine-readable output that does not depend on locale or human-readable rounding.

lsblk is an inventory tool, not a partitioning or diagnostic tool. Its neighbors in the filesystem toolset each answer a narrower question, and knowing which one to run saves time and avoids running privileged tools unnecessarily.

The comparison below places lsblk among the commands most often confused with it.

CommandMain question answeredRoot neededChanges data
lsblkWhich block devices exist and how they nestNo, for most columnsNo
blkidWhich filesystem signature and UUID a device hasOften yesNo
fdisk -lWhat the partition table containsYesNo, in list mode
dfHow much space mounted filesystems useNoNo
findmntWhat is mounted where, with optionsNoNo
mountAttach a filesystem to a mount pointYesYes, changes mount state
lsblk and neighboring commands

A common source of confusion is the difference between lsblk and df. lsblk reports the size of the device, while df reports the used and free space inside a mounted filesystem. A 500 GB partition can show 500G in lsblk and only 120G used in df, and both values are correct.

In daily administration, lsblk is used to identify the correct device before a destructive action, such as formatting with mkfs, writing an image or extending a logical volume. Running it before and after plugging in a device is the most reliable way to see which name the kernel assigned.

The decision table below matches common tasks with the most useful invocation.

TaskCommandWhy
Find a new USB drivelsblk -o NAME,SIZE,RM,MODELRM and MODEL reveal removable media
Write an fstab entrylsblk -fShows UUID and filesystem type
Inspect an LVM or LUKS stacklsblk with no optionsTree shows each layer
Check SSD versus HDDlsblk -d -o NAME,ROTAROTA flag separates disk types
Feed a scriptlsblk -J -bJSON with exact byte sizes
Check discard supportlsblk --discardShows TRIM granularity values
Choosing an lsblk invocation for a task
  • Use `-d` to hide partitions and list only whole disks.
  • Use `-e7` to exclude loop devices, which clutter output on systems with snap packages.
  • Use `-T` with a column list to control the tree output in newer util-linux versions.

Limitations and common mistakes

lsblk shows what the kernel currently knows, so it can be misleading right after changes. A new partition created with a partitioning tool may not appear until the kernel rereads the partition table, for example with partprobe, and empty FSTYPE fields often mean the udev database has not been updated rather than that the device is blank.

The table below lists symptoms that administrators frequently misread.

SymptomReal causeFix
FSTYPE and UUID are emptyudev data missing or no read accessRun as root or udevadm settle
New partition is missingKernel still uses the old tableRun partprobe or reboot
Many loop devices listedSnap or image mountsExclude major number 7 with -e7
Device names changed after rebootKernel names are not persistentUse UUID or LABEL in fstab
Mount point missing in a containerDifferent mount namespaceRun lsblk in the host namespace
Misread lsblk output and the real cause

The most serious mistake is relying on device names such as `/dev/sdb` in scripts or fstab. These names depend on detection order and can change between boots, so persistent identifiers like UUID, PARTUUID or LABEL are the safe choice.

A non-technical view

lsblk is like a floor plan of the storage in a computer. It shows every disk, how each disk is divided into sections, and which folder each section is connected to. It only looks; it never changes anything.

People run it whenever they need to be sure which disk is which, for example before erasing a USB stick. The key takeaway is simple: check with lsblk first, then act on the right device.

A concrete example

A support technician must write a Linux installer image to a 16 GB USB stick on a workstation that also contains two internal drives. Choosing the wrong target with dd would erase the internal data.

Before inserting the stick, the technician runs lsblk -d -o NAME,SIZE,RM,MODEL and sees nvme0n1 at 953.9G and sda at 1.8T, both with RM set to 0. After inserting the stick, the same command shows a new device `sdb` at 14.6G with RM set to 1, which matches a removable 16 GB stick reported in binary units.

The technician then writes the image to /dev/sdb and runs lsblk again to confirm the new partitions. The internal drives remain untouched, and the whole check takes less than a minute.