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 man Command: Read Command Manual Pages

Linux man Command: Read Command Manual Pages

Learn how to use the Linux man command to find and read command manuals, sections, options, and related pages, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux pacman Command: Manage Packages on Arch Linux

Linux pacman Command: Manage Packages on Arch Linux

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

Linux shred Command: Overwrite File Data and Understand Its Limits

Linux shred Command: Overwrite File Data and Understand Its Limits

Learn how Linux shred overwrites file data, which options control its passes and removal, and why SSDs, snapshots, backups, and modern filesystems limit its guarantees.

Linux ip Command: Inspect and Configure Network Interfaces and Routes

Linux ip Command: Inspect and Configure Network Interfaces and Routes

Learn how to inspect and Configure Network Interfaces and Routes with the Linux ip command, including practical examples, key options, and important precautions.

Linux renice Command: Change the Priority of a Running Process

Linux renice Command: Change the Priority of a Running Process

Learn how to change the Priority of a Running Process with the Linux renice command, including practical examples, key options, and important precautions.

Linux timedatectl Command: Check Time Zone and Time Synchronization

Linux timedatectl Command: Check Time Zone and Time Synchronization

Learn how to check Time Zone and Time Synchronization with the Linux timedatectl command, including practical examples, key options, and important precautions.

Linux lsblk Command: Inspect Disks, Partitions, and Mounts

Linux lsblk Command: Inspect Disks, Partitions, and Mounts

Learn how to inspect Disks, Partitions, and Mounts with the Linux lsblk command, including practical examples, key options, and important precautions.

Linux Tutorial / Understand Users, Groups, and File Ownership

Linux Tutorial / Understand Users, Groups, and File Ownership

Understand UIDs, GIDs, primary and supplementary groups, and file ownership, then inspect them safely with id, groups, getent, ls, and stat.

Linux kill Command: Send a Signal to a Process ID

Linux kill Command: Send a Signal to a Process ID

Learn how to send a Signal to a Process ID with the Linux kill command, including practical examples, key options, and important precautions.

Linux touch Command: Create Files and Change Timestamps

Linux touch Command: Create Files and Change Timestamps

Learn how to use the Linux touch command to create empty files and change access or modification timestamps, including reference times, date formats, and symlink handling.