lsblk
Installation
SKILL.md
Identity
| Property | Value |
|---|---|
| Binary | lsblk |
| Config | No persistent config — invoked directly |
| Logs | No persistent logs — output to terminal |
| Type | CLI tool (part of util-linux) |
| Install | apt install util-linux / dnf install util-linux (pre-installed on all Linux systems) |
Key Operations
| Task | Command |
|---|---|
| Default tree view (names, sizes, types, mountpoints) | lsblk |
| Include all empty and RAM block devices | lsblk -a |
| Show filesystem info (UUID, FSTYPE, LABEL, MOUNTPOINT) | lsblk -f |
| JSON output for scripting | lsblk -J |
| Key=value pairs output | lsblk -P |
| Query a specific device only | lsblk /dev/sda |
| Show sizes in raw bytes | lsblk -b |
| Custom columns: name, size, UUID, label, mountpoint | lsblk -o NAME,SIZE,UUID,LABEL,MOUNTPOINT |
| Custom columns with filesystem type | lsblk -o NAME,SIZE,FSTYPE,UUID,LABEL,MOUNTPOINT,TYPE |
| Show topology information (queues, alignment) | lsblk -t |
| Show disk serial numbers and model | lsblk -o NAME,SIZE,SERIAL,MODEL,TYPE |
| Exclude loop devices (snap/flatpak noise) | lsblk -e 7 |
Device Naming Reference
| Pattern | Meaning |
|---|---|
sda, sdb |
SATA/SAS/USB disks (first, second) |
sda1, sda2 |
Partitions on sda |
nvme0n1 |
First NVMe drive, namespace 1 |
nvme0n1p1 |
First partition on NVMe drive |
vda, vdb |
Virtio block devices (KVM/QEMU VMs) |
mmcblk0 |
eMMC / SD card |
mmcblk0p1 |
Partition on eMMC |
md0 |
Software RAID device (mdadm) |
dm-0, dm-1 |
Device mapper device (LVM LV or LUKS) |
loop0..loop7 |
Loop devices (snap packages, mounted images) |
Common Failures
| Symptom | Cause | Fix |
|---|---|---|
MOUNTPOINT column blank for a mounted device |
Device is bind-mounted or mounted in a namespace | findmnt gives a more complete picture of all mounts |
Many loop devices cluttering output |
snap or flatpak packages each create a loop device | lsblk -e 7 to exclude loop devices (7 is the loop device major number) |
dm-* devices shown without context |
LVM logical volumes or LUKS containers — names are not descriptive | lvdisplay for LVM details; dmsetup ls to see dm device purpose |
| NVMe drive not shown | Kernel NVMe module not loaded | modprobe nvme; check `dmesg |
| Partition not shown as child of disk | Disk uses a partition table type kernel did not recognize | gdisk -l /dev/sdX to inspect; partprobe /dev/sdX to re-read table |
lsblk -f shows no UUID for a partition |
Partition exists but has no filesystem | Format with mkfs.ext4 /dev/sdX1 or appropriate filesystem tool |
Pain Points
- Reads from sysfs, not root required: lsblk does not require root and reads from
/sys/block. This also means it can only report what the kernel knows — if a partition table change was made withoutpartprobe, lsblk will show stale data. MOUNTPOINTshows only the first mount: if a device is mounted in multiple places (bind mounts, bind namespaces),lsblkshows only one mountpoint. Usefindmnt --source /dev/sdX1to see all mount points for a device.- dm- naming is opaque*: Device mapper devices (
dm-0,dm-1) are LVM logical volumes or LUKS containers. The name carries no semantic meaning. Cross-reference withlvdisplay(LVM),cryptsetup status /dev/mapper/name(LUKS), ordmsetup ls --tree(full dependency tree). - loop devices from snap/flatpak: Each snapped application mounts a squashfs image via a loop device. These are legitimate but inflate
lsblkoutput on desktop systems. Use-e 7to exclude them entirely when looking at real storage devices. -fflag does not show size:lsblk -fswitches the column set to filesystem-centric columns and dropsSIZE. Combine explicitly:lsblk -o NAME,SIZE,FSTYPE,UUID,LABEL,MOUNTPOINTto get both.
References
See references/ for:
cheatsheet.md— 10 task-organized patterns for common lsblk workflowsdocs.md— man pages and upstream documentation links
Related skills