Where to start First steps track · 15 stages
Linux Labs

lsblk — block devices

3 min util-linux

A tree of disks, partitions, and logical volumes — size, filesystem, mountpoint.

Cheat sheet

6 commands Printable version
  • lsblk tree: disks → partitions → LVM/RAID
  • lsblk -f + filesystem, UUID, mountpoint
  • lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT custom columns
  • lsblk -d disks only, no partitions
  • lsblk -p /dev/sdb one device, full path
  • lsblk -e 7 skip loop devices (major 7)

Overview

lsblk reads the block device tree from /sys/block — no root needed, and it never touches the disks themselves. It shows disks, partitions, LVM volumes, and RAID arrays as a single hierarchy: what is built on top of what.

bash
lsblk -f
# NAME   FSTYPE  UUID                                 MOUNTPOINT
# sda
# ├─sda1 vfat    1234-5678                             /boot/efi
# └─sda2 ext4    1234abcd-...                          /

It's an overview of devices, not of used space (for that, see disk-usage) and not a list of active mounts (for that, findmnt or mount).

Options

6

Below are the main flags; the full list is in man lsblk.

Option What it does Example
-f --fs Add filesystem type, UUID, label, and mountpoint columns. lsblk -f
-o LIST Custom columns instead of the default set (comma-separated). lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT
-d --nodeps Devices only, without partitions and child devices. lsblk -d
-p --paths Full device path (/dev/sda1) instead of the bare name. lsblk -p
-e --exclude LIST Exclude device types by major number (7 is loop devices). lsblk -e 7
-a --all Also show empty devices (no partition or filesystem). lsblk -a

Nothing found. Try a shorter query.

Recipes

3

Find a new disk before partitioning it

bash
lsblk                              # no FSTYPE/MOUNTPOINT — the device is still empty
lsblk -f                           # confirm: empty filesystem and mountpoint

Mountpoints and UUIDs for fstab

bash
lsblk -f                           # the MOUNTPOINT column — what's mounted where
blkid /dev/sdb1                    # UUID and filesystem type, a separate command

Custom columns for scripts

bash
lsblk -no NAME,SIZE                # no header — easy to parse line by line
lsblk -o NAME,TYPE,SIZE -p          # with the full device path

Troubleshooting

3

Plugged in a disk, but lsblk doesn't show it

lsblk doesn't rescan the bus — the kernel has to see the device first. Check dmesg | tail (see kernel-modules) or rescan the SCSI host: echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan.

The device is in lsblk, but not mounted

lsblk -f with an empty MOUNTPOINT column — the partition exists but isn't mounted and/or isn't in /etc/fstab. Next step: mount.

Device names shift between reboots

/dev/sdX can change when disks are reordered. Use the UUID in fstab and scripts (lsblk -f or blkid), not the bare device name.

See also

  • fdisk-parted — partition the new disk lsblk found.
  • blkid — filesystem UUID and label as a separate command.
  • loop-device — where the loopN devices in the list come from.
  • mount — Mounting and fstab — mountpoints, UUIDs, bind mounts and tmpfs.
  • disk-usage — Where did the space and inodes go — df, du, finding large files.
  • lvm — PV → VG → LV; flexible disk management, extending and snapshots.
Loading…