What's blkid?
The blkid command (block device id) is a command line utility that is part of the util-linux package in most Linux distributions. Its main function is to show information about block devices, such as the file system type, the UUID and the label. This information is essential when you need to safely mount partitions, create inputs in / etc / fstab or diagnose storage problems.
Basic syntax
The easiest use of blkid is to run it without arguments, which lists all the detected block devices and their attributes. The general syntax is:
blkid [options] [device]
Some useful options include:
- -s
: shows only the specified field (e.g. UUID or TYPE). - -p: displays information in parable format, ideal for scripts.
- -or
: defines the output format (value, list, udev). - -d: omits the loop device and other virtual devices.
Examples of use
- To view all devices and their full information:
blkid - To obtain only the UUID of the partition / dev / sda1:
blkid -s UUID -o value /dev/sda1 - To list all devices with your file system type:
blkid -s TYPE -o value - To use the parable output in a script:
blkid -p -o udev
Interpretation of the exit
The typical blkid output looks like the following:
/ dev / sda1: UUID = '3f8b2e1c-6a4d-4f9b-8e2a-1c7d5f6a9b2c' TYPE = 'ext4' PARTUUID = '00112233-01'
Each line starts with the device name, followed by key pairs = value between simple quotes. The most common fields are:
- UUID: unique file system identifier, independent of the device name.
- TYPE: indicates the type of file system (ext4, xfs, vfat, ntfs, etc.).
- LABEL: user-readable label, if one has been assigned.
- PARTUUID: unique partition identifier, useful in systems using GPT.
Tips and good practices
- Always check the UUID before editing / etc / fstab; using the UUID avoids problems if the order of the devices changes.
- In boot or automatic mounting scripts, you prefer the -p -or udev option to get an easy-to-stop output.
- If you need information on a specific device, specify your route (e.g., / dev / nvme0n1p2) to avoid scanning the entire system.
- Remember that blkid requires reading privileges on the device; it usually runs as root or with sudo.


