blkid(8)
Locate and identify block devices and their attributes like UUID, filesystem type, and labels.
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
| Flag | What it does |
|---|---|
-L LABEL | Find device with specified label and print its name |
-U UUID | Find device with specified UUID and print its name |
-l | Look up one device and print device name only (used with -L or -U) |
-o FORMAT | Output format: value, udev, export, full; default is full |
-s TAG | Show only specified tag; common tags: TYPE, UUID, LABEL, PARTUUID |
-p | Probe devices directly (slower but more current than cache) |
-c FILE | Read from alternate cache file instead of /etc/blkid.tab |
-i | Print I/O Limits (optimal I/O size, alignment, minimum I/O size) |
-g | Garbage collect the cache and exit |
Examples
Display all block devices with their UUID, TYPE, and LABEL
blkidFind the device with specified UUID and print its path
blkid -U a1b2c3d4-e5f6-7890-abcd-ef1234567890Find device labeled 'mydisk' and print its name
blkid -L mydiskPrint only the UUID of /dev/sda1
blkid /dev/sda1 -s UUIDOutput block device attributes in key=value format for scripting
blkid -o export /dev/sdb1Show only the filesystem type of NVMe device
blkid /dev/nvme0n1 -s TYPEProbe /dev/sdc directly instead of reading cache
blkid -p /dev/sdc