Linux blkid Command: Find Block-Device UUIDs and Filesystem Types

`blkid` queries identification information such as the file system type, UUID, and label recorded on a block device. It is used to check mount settings or device identifiers.

What is the blkid command?

UUID is a value that identifies the file system and is less sensitive to changes in the connection order than the device path. `TYPE` refers to the type of the file system, and `LABEL` refers to the assigned name. Some devices may not be displayed depending on permissions or cache status, and cloned file systems can have duplicate UUIDs.

Basic syntax

blkid [options] [device]

The installed implementation and options may vary depending on the distribution. Check the description for the current system with `man blkid`.

Examples

Query recognizable devices

Displays identification information for devices that can be queried.

sudo blkid

Query a specific partition

Replace the device name with the actual path checked using lsblk.

sudo blkid /dev/sdb1

Extract only UUID values

Check the values to be used in the configuration file in a single line.

sudo blkid -s UUID -o value /dev/sdb1

Checking UUID and Filesystem Type

blkid queries the UUID, filesystem type, label, and other information of block devices. Depending on permissions or cache status, some information may not be visible to regular users.

sudo blkid /dev/sda2

Example output (identifiers are for illustration purposes):

/dev/sda2: UUID="11111111-2222-3333-4444-555555555555" TYPE="ext4"

UUID is useful for referring to the same filesystem even if the device name is rearranged, so it is often used in /etc/fstab. However, creating a new filesystem or cloning it may result in a different or duplicate UUID. Before copying settings, check the actual target device's UUID along with the mount relationship.

Main Options and Format

Options/Format Description
-s tag Select only specific tags like UUID/TYPE.
-o format Specify the output format. 'value' outputs only the value.
-L label Find devices that match the label.
-U UUID Find devices that match the UUID.
-p Perform a low-level check.

Precautions when using

Right after cloning a device, the UUID may be duplicated, so do not rely solely on the UUID when performing write operations. Even if the output under regular user permissions is empty, it does not necessarily mean that the device or file system is absent. Before actual formatting or mounting, double-check the device size and mount status.

Frequently Asked Questions

Are the UUID and PARTUUID from blkid the same?

No. The UUID is mainly a file system identifier, while the PARTUUID is a partition identifier assigned in the partition table.

Official Documentation

The exact behavior of the options and implementation differences can be checked in the official blkid documentation.

More in This Category
Linux zypper Command: Manage Packages on openSUSE and SUSE

Linux zypper Command: Manage Packages on openSUSE and SUSE

Learn how to manage Packages on openSUSE and SUSE with the Linux zypper command, including practical examples, key options, and important precautions.

Essential Linux Commands: A Practical Reference by Task

Essential Linux Commands: A Practical Reference by Task

Browse essential Linux commands by task, including help, files, text processing, permissions, processes, networking, packages, storage, and system administration.

A History of Linux: From a 1991 Hobby Project to Global Infrastructure

A History of Linux: From a 1991 Hobby Project to Global Infrastructure

Trace the history of Linux from Unix and the GNU Project through the first Linux kernel, distributions, enterprise adoption, cloud computing, containers, and modern infrastructure.

Linux dd Command: Copy and Convert Data by Blocks

Linux dd Command: Copy and Convert Data by Blocks

Learn how to copy and convert files or block devices with Linux dd, choose block sizes and ranges, display progress, verify results, and avoid overwriting the wrong device.

Linux diff Command: Compare Text Files and Directories

Linux diff Command: Compare Text Files and Directories

Learn how Linux diff compares text files and directories, produces unified patches, ignores selected whitespace changes, and reports differences through exit status.

Best Linux Distributions for Web Servers: Ubuntu, Debian, or Rocky Linux?

Best Linux Distributions for Web Servers: Ubuntu, Debian, or Rocky Linux?

Compare Ubuntu Server, Debian, and Rocky Linux for web hosting based on support lifecycle, package freshness, documentation, operational stability, and application requirements.

Linux Tutorial / How the Shell Runs Commands: ;, &&, ||, Aliases, and Environment Variables

Linux Tutorial / How the Shell Runs Commands: ;, &&, ||, Aliases, and Environment Variables

Learn how Bash resolves commands and uses exit status with ;, &&, and ||, then distinguish aliases, shell variables, and exported environment variables.

Linux rsync Command: Synchronize Files and Directories

Linux rsync Command: Synchronize Files and Directories

Learn how to synchronize Files and Directories with the Linux rsync command, including practical examples, key options, and important precautions.

Linux free Command: Check Memory and Swap Usage

Linux free Command: Check Memory and Swap Usage

Learn how to use the Linux free command to inspect available memory, used memory, cache, and swap usage, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux rmdir Command: Remove Empty Directories

Linux rmdir Command: Remove Empty Directories

Learn how to remove empty directories with Linux rmdir, delete empty parent paths, diagnose failures, and understand when rm -r is different.