lsblk system

what disks do I have and where did they go.

The lsblk man page is 200 lines long. You need one command and zero flags.

You have disks. You don’t know how many. You don’t know how big they are. You don’t know which one is your boot drive and which one is the 2TB data disk you added last month. You definitely don’t remember what /dev/sdc2 is or whether it’s mounted anywhere.

On Windows, you’d open Disk Management. You’d wait for it to load (it always takes a moment, like it’s checking with the disks first to make sure they’re comfortable being displayed). You’d see a visual layout with colored bars and labels like “Healthy (Primary Partition)” which tells you nothing about what’s actually on it. You’d right-click things and look at properties. Multiple clicks. Multiple windows. Multiple minutes.

lsblk shows you everything in one command. Every disk, every partition, sizes, types, and mount points — in a clean tree format that actually makes sense.

Unless you’re running Windows then wtf none of this applies to you. But hey, come to the dark side, go install WSL2 and you can follow along. We’ll wait. Impatiently.

If you’re lazy like me (all sysadmins are!) then click here for the lsblk cheat sheet.


List all block devices

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   100G  0 disk
├─sda1   8:1    0    99G  0 part /
└─sda2   8:2    0     1G  0 part [SWAP]
sdb      8:16   0     2T  0 disk
└─sdb1   8:17   0     2T  0 part /mnt/data
sdc      8:32   1    32G  0 disk
└─sdc1   8:33   1    32G  0 part

The tree view shows the hierarchy: sda is a 100G disk with two partitions — a 99G root partition and 1G swap. sdb is a 2TB data disk mounted at /mnt/data. sdc is a 32G removable device (the 1 in the RM column) with one partition that isn’t mounted anywhere.

That’s your entire disk layout. One command. No Disk Management. No waiting.


Show filesystems

lsblk -f
NAME   FSTYPE LABEL  UUID                                 MOUNTPOINT
sda
├─sda1 ext4   root   a1b2c3d4-e5f6-7890-abcd-ef1234567890 /
└─sda2 swap          b2c3d4e5-f6a7-8901-bcde-f12345678901 [SWAP]
sdb
└─sdb1 ext4   data   c3d4e5f6-a7b8-9012-cdef-123456789012 /mnt/data
sdc
└─sdc1 ntfs   BACKUP

Filesystem types, labels, and UUIDs. Now you know sdc1 is an NTFS partition labeled “BACKUP” — it’s probably a Windows-formatted USB drive. The UUID is what you’d use in fstab to make a mount permanent.


Show specific columns

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,FSTYPE

Pick exactly the columns you want. Useful for scripts or when you need specific information without the noise.

All available columns

lsblk -o +MODEL,SERIAL,VENDOR

The + adds columns to the defaults. Model and serial number tell you the physical hardware — useful when you’re in a data center trying to figure out which physical drive corresponds to which device name.

lsblk --help

Lists all available column names at the bottom.


Show sizes in bytes

lsblk -b

Sizes in bytes instead of human-readable. For when you need exact numbers in scripts, not rounded “100G” values.


List only specific devices

lsblk /dev/sda
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  100G  0 disk
├─sda1   8:1    0   99G  0 part /
└─sda2   8:2    0    1G  0 part [SWAP]

Focus on one device and its partitions. Ignore everything else.


Show as a flat list (no tree)

lsblk -l

No tree formatting. One line per device/partition. Easier to parse with scripts, harder for humans to read the hierarchy.


Exclude loop devices

lsblk -e 7

Loop devices (major number 7) are virtual devices used by snap packages and ISO mounts. They clutter the output on Ubuntu systems that use snap. Exclude them to see only real hardware.


JSON output

lsblk -J

Outputs JSON. Pipe it to jq for structured queries:

lsblk -J | jq '.blockdevices[] | select(.type == "disk") | .name'

List just the disk names programmatically.


The columns that actually matter

Column What it shows
NAME Device name (sda, sdb1, etc.).
SIZE Device/partition size.
TYPE disk, part, rom, lvm, etc.
MOUNTPOINT Where it’s mounted (empty if not mounted).
FSTYPE Filesystem type (ext4, xfs, ntfs, swap).
RM Removable (1 = yes, like USB drives).
RO Read-only (1 = yes).
UUID Filesystem UUID (for fstab).
LABEL Filesystem label.
MODEL Hardware model name.

The flags that actually matter

Flag What it does
-f Show filesystem info (type, UUID, label).
-o COLUMNS Show specific output columns.
-l List format (no tree).
-b Sizes in bytes.
-J JSON output.
-e N Exclude devices by major number (7 = loop).
-p Show full device paths (/dev/sda instead of sda).

“But Disk Management—”

Sure.

“Disk Management shows me everything.” Disk Management shows you a graphical layout that takes 10 seconds to load, doesn’t include filesystem UUIDs, can’t be piped to other commands, and requires you to open a GUI on a server. lsblk -f shows more information, instantly, over SSH.

“I use fdisk -l.” fdisk -l shows partition tables with sector-level detail, partition types, and boot flags. It’s more information than you usually need and it requires root. lsblk shows the practical stuff — sizes, mount points, filesystem types — without sudo.

“I use df for disk info.” df shows filesystem usage (how full each disk is). lsblk shows physical layout (what devices exist and how they’re partitioned). Different questions. lsblk answers “what do I have?” df answers “how full is it?”


lsblk cheat sheet

You made it. Or you skipped straight here. Either way, no judgment. Copy and paste these. Pin them. Tattoo them on your forearm. Whatever works.

What you’re doing Command
List all disks and partitions lsblk
Show filesystem types and UUIDs lsblk -f
Custom columns lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT
Show hardware model lsblk -o +MODEL,SERIAL
Exclude snap loop devices lsblk -e 7
JSON output lsblk -J
Focus on one device lsblk /dev/sda

The one command: lsblk -f — every disk, every partition, filesystem types, UUIDs, labels, and mount points. The complete picture in one command.

Back to the top, you overachiever.