$linuxjunkies
>

blkid(8)

Locate and identify block devices and their attributes like UUID, filesystem type, and labels.

UbuntuDebianFedoraArch

Synopsis

blkid [-L LABEL] [-U UUID] [-l] [-c FILE] [-o FORMAT] [-s TAG] [DEVICE...]

Description

blkid is a command-line utility for locating and printing block device attributes. It probes block devices for filesystems, UUIDs, labels, and partition types, making it essential for identifying disks, partitions, and their characteristics without mounting them.

By default, blkid prints device name, UUID, TYPE (filesystem), and LABEL. It reads from the system's block device cache or can probe devices directly with -p. Commonly used to find devices by UUID or label before mounting, or to verify filesystem information.

Common options

FlagWhat it does
-L LABELFind device with specified label and print its name
-U UUIDFind device with specified UUID and print its name
-lLook up one device and print device name only (used with -L or -U)
-o FORMATOutput format: value, udev, export, full; default is full
-s TAGShow only specified tag; common tags: TYPE, UUID, LABEL, PARTUUID
-pProbe devices directly (slower but more current than cache)
-c FILERead from alternate cache file instead of /etc/blkid.tab
-iPrint I/O Limits (optimal I/O size, alignment, minimum I/O size)
-gGarbage collect the cache and exit

Examples

Display all block devices with their UUID, TYPE, and LABEL

blkid

Find the device with specified UUID and print its path

blkid -U a1b2c3d4-e5f6-7890-abcd-ef1234567890

Find device labeled 'mydisk' and print its name

blkid -L mydisk

Print only the UUID of /dev/sda1

blkid /dev/sda1 -s UUID

Output block device attributes in key=value format for scripting

blkid -o export /dev/sdb1

Show only the filesystem type of NVMe device

blkid /dev/nvme0n1 -s TYPE

Probe /dev/sdc directly instead of reading cache

blkid -p /dev/sdc

Related commands