blkid reads the labels, UUIDs and filesystem types already stamped on a block device. You identify a disk without mounting it or guessing from its device name. The examples are read-only: they do not mount, format or modify a device.
Allow about fifteen minutes. You need a shell and the util-linux blkid command. This guide follows the installed blkid(8) manual, generated for util-linux 2.39.3. On this host, blkid --version resolves to a separate Homebrew installation of util-linux 2.41.3, so check your own command before relying on small output differences. Reading a device directly may require elevated privileges; use sudo only for a command you understand.
Start with version and path checks. These are ordinary read-only commands and do not need root:
$ command -v blkid
$ blkid --version
blkid from util-linux 2.41.3 (libblkid 2.41.3, 15-Dec-2025)
Your version may differ. The manual's option names and exit statuses are the contract to keep in mind, but the binary on your PATH is what actually runs. If you expected the distribution copy, inspect the path before debugging an apparent version mismatch.
Checkpoint: Record the path and version. If the command is missing, install the util-linux package through your normal operating-system process. Do not download a replacement binary into a system directory just to test one option.
Pass a device path when you know which block device you want to inspect. Replace /dev/DEVICE with a real device from your machine. The command only reads metadata:
$ blkid /dev/DEVICE
/dev/DEVICE: UUID="..." TYPE="ext4"
The exact fields depend on the device. Common tokens include LABEL, UUID, TYPE, PARTUUID and PARTLABEL. Output order is not fixed, so scripts should select a tag rather than parse the whole line by position. To ask for one tag, use --match-tag:
$ blkid --match-tag TYPE /dev/DEVICE
/dev/DEVICE: TYPE="ext4"
$ blkid --match-tag UUID /dev/DEVICE
/dev/DEVICE: UUID="..."
Multiple --match-tag options can be supplied. A tag filter changes what is printed, not whether the device was identified, and that distinction matters when you check the exit status.
For a shell script or a diagnostic record, choose an output format explicitly:
--output export prints key and value pairs, with unsafe characters escaped.--output value prints tag values without the tag name.--output device prints only the device name.full is the default, and the older list and udev formats are deprecated, so do not start new scripts with them.$ blkid --output export /dev/DEVICE
DEVNAME=/dev/DEVICE
UUID=...
TYPE=ext4
Check the output contract of the util-linux version deployed on your target systems before writing a parser. Do not put a raw blkid line into a shell command without quoting: labels are metadata and may contain whitespace or shell-significant characters. Treat every value as data.
Use --match-token NAME=value to search for a token. This searches all recognised devices when no device argument is given:
$ blkid --match-token 'LABEL=ARCHIVE'
/dev/DEVICE: LABEL="ARCHIVE" UUID="..." TYPE="ext4"
Limit the search to a known set of devices by appending their paths:
$ blkid --match-token 'TYPE=ext4' /dev/DEVICE /dev/OTHER_DEVICE
Use --list-one when a lookup must return only one match:
$ blkid --list-one --output device --match-token 'LABEL=ARCHIVE'
/dev/DEVICE
When several devices share a label or UUID, choosing one is a policy decision, not proof that the metadata is unique. Verify the result with a second command before using it in an automated mount or recovery workflow.
Normal non-root operation can return cached, unverified information. That suits a quick overview, but it can mention a device that has gone away or miss metadata that has just changed. Use --cache-file /dev/null to start with an empty cache for that invocation:
$ blkid --cache-file /dev/null /dev/DEVICE
/dev/DEVICE: UUID="..." TYPE="ext4"
This does not erase the normal cache; it tells this process to read from /dev/null instead. If direct probing is denied, rerun the same read-only check with elevated privileges:
$ sudo blkid --cache-file /dev/null /dev/DEVICE
Before using sudo, confirm the device path with lsblk or your inventory system: a typo can make a correct answer about the wrong disk. The recommended overview tool is usually lsblk --fs, which normally needs no root permission and presents filesystem information across devices.
--probe switches to low-level superblock probing and bypasses the cache. It can expose partition-table and partition-entry tags as well as filesystem metadata:
$ sudo blkid --probe /dev/DEVICE
/dev/DEVICE: UUID="..." VERSION="1.0" TYPE="ext4" USAGE="filesystem"
The exact fields vary by content and util-linux version. Low-level tags may use names such as PART_ENTRY_UUID where ordinary mode uses PARTUUID. Use --no-part-details when partition-entry tags would distract from the superblock result. Restrict a probe when you know what kind of content is expected:
$ sudo blkid --probe --usages filesystem /dev/DEVICE
$ sudo blkid --probe --match-types ext4,xfs /dev/DEVICE
These options narrow the probing functions; they do not convert a device or repair a filesystem. Do not confuse --probe with a write operation. If the result is ambivalent because multiple filesystem signatures collide, stop and investigate with wipefs before considering any erase operation: erasing signatures is destructive and is outside this guide.
Capture the status immediately after the command you are testing:
$ blkid --match-token 'LABEL=DOES_NOT_EXIST'
$ printf 'blkid status: %s\n' "$?"
blkid status: 2
0 means a device or token was found and some information was gathered.2 means the token was not found, or no device could be identified.4 indicates usage or another error.8 can appear during low-level probing for an ambivalent result.A successful status does not mean a requested tag was printed if your filter excluded it. For a final cross-check, compare the result with the filesystem overview:
$ lsblk --fs /dev/DEVICE
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
... ext4 ... ... ... ... ...
If the tools disagree, do not immediately edit a configuration file. Check whether one command used cached data, whether you queried a partition rather than its parent disk, and whether you have permission to read the device. For a device with overlapping or obsolete signatures, preserve evidence and investigate before writing anything.
blkid binary and its util-linux version.UUID, LABEL and TYPE.--cache-file /dev/null.--probe reads low-level metadata but does not repair or format a device.lsblk --fs before taking any write action.