Linux lsblk command explained for embedded systems

What is lsblk?

The lsblk command is one of the most important Linux commands used during embedded Linux bring-up.

It helps engineers verify storage detection, partition layout, and root filesystem mounting on devices such as eMMC, SD card, and NAND-based systems.

lsblk stands for list block devices.

It is used to display information about storage devices such as:

  • eMMC
  • SD card
  • USB storage
  • NAND/NOR block devices
  • Partitions

In embedded Linux systems, lsblk is one of the most important commands for verifying storage detection during bring-up.

Why lsblk is important in embedded systems

During embedded Linux development, storage-related problems are very common:

  • SD card not detected
  • eMMC partitions missing
  • Root filesystem not mounted
  • Wrong partition layout
  • Device nodes not created

The lsblk command helps you quickly confirm:

  • Whether the kernel detected the storage
  • Partition structure
  • Mount points
  • Device hierarchy

Basic Syntax

lsblk

This shows all the available block devices in a tree

Example Output

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 7.3G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 7.0G 0 part /

Understanding the output

ColumnMeaning
NAMEDevice name
MAJ:MINMajor and minor device numbers
RMRemovable device
SIZEDevice or partition size
RORead-only flag
TYPEdisk / part
MOUNTPOINTWhere it is mounted

Common block device names in embedded Linux

DeviceMeaning
mmcblk0Primary eMMC or SD card
mmcblk0p1Partition 1
mmcblk0p2Partition 2
sdaUSB storage
mtdblock0NAND block device

Useful lsblk options

Show filesystem type

lsblk -f

Example

NAME FSTYPE LABEL UUID MOUNTPOINT
mmcblk0p1 vfat 12AB-34CD /boot
mmcblk0p2 ext4 a1b2c3d4-e5f6 /

This is extremely useful for verifying root filesystem format.

Show size in human-readable format

lsblk -h

Shows sizes like MB, GB.

Show only block devices (no RAM disks)

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

Useful when debugging minimal rootfs

lsblk vs df vs mount

CommandPurpose
lsblkShows device and partition structure
dfShows filesystem usage
mountShows mounted filesystems

During bring-up, lsblk is used first, then mount, then df.

Practical embedded Linux use cases

1. Verify SD card detection

After boot:

lsblk

If mmcblk0 does not appear → kernel or device tree issue.

2. Verify partition layout

Check whether expected partitions exist:

  • boot
  • rootfs
  • data
lsblk

Wrong partition table → Yocto image issue

3. Check root filesystem mount

Look at MOUNTPOINT.

If / is missing → boot argument issue.

Common issues and debugging

Issue: lsblk command not found

On minimal systems (BusyBox):

  • lsblk may not be enabled

Solution:

  • Enable util-linux in Yocto
  • Or enable lsblk in BusyBox config

Issue: Device visible in dmesg but not in lsblk

Possible reasons:

  • No partition table
  • Block driver not enabled
  • Missing udev

Check:

dmesg | grep mmc

Summary

  • lsblk lists block devices and partitions
  • Essential for embedded Linux bring-up
  • Helps debug storage, rootfs, and boot issues
  • Used heavily during Yocto development
  • One of the first commands engineers run after boot

What to learn next

After understanding lsblk, continue with:

  • mount command
  • df command
  • Linux filesystem layout
  • Root filesystem concepts

These topics are crucial before moving to Yocto and BSP development.

Leave a Comment