blkid (block device ID) — Inspect block device UUIDs and file systems
Linux / File and disk management / blkid.html
A util-linux tool that reports the UUID, file system type and label of block devices.
Basic Information
| Command Name | blkid (block device ID) |
|---|---|
| One-line Introduction | A util-linux tool that reports the UUID, file system type and label of block devices. |
| Provided by | util-linux (installed by default on all Linux distributions) |
| Official Documentation | https://man7.org/linux/man-pages/man8/blkid.8.html |
| Supported Operating Systems | Linux, WSL |
| Installation Status | Installed by default (no separate installation needed) |
| Category | Linux file and disk management (tags: UUID, file system, block device, util-linux) |
What is this command?
blkid scans the block devices known to the kernel and shows metadata such as the file system type, UUID, PARTUUID and label.
It is the first tool to reach for when writing UUID-based /etc/fstab entries or checking which device name a newly attached disk received.
What problems does it solve?
- You need a file system UUID for /etc/fstab
- You must find the device name of a newly attached disk
- You want a quick file system type lookup
- You need to verify labels and UUIDs before mounting
Key features
Show device metadata
Without arguments it prints information for every detected block device.
- When to use: You want an overview of all disks
- What you get: A list of device name, UUID, TYPE and LABEL
- Limitations: Unmounted devices are included, so output can be long.
Query one device
Passing a device path limits the output to that device.
- When to use: You are verifying a device for an fstab entry
- What you get: The UUID and file system type of that device
- Limitations: Device names can change after reboot, so prefer UUIDs.
Refresh the cache
Right after creating a file system the cache may be stale and hide the new metadata.
- When to use: blkid shows nothing right after formatting
- What you get: Up-to-date device information
- Limitations: Refreshing the cache requires root privileges.
Installation and usage
Check whether it is installed
blkid --version
sudo apt install util-linux # Debian/Ubuntu sudo dnf install util-linux # Fedora
Real-world examples
List every block device
Prints the full list including UUID and type.
sudo blkid
Extract a UUID for fstab
Pick only the UUID of one device for a mount entry.
sudo blkid -s UUID -o value /dev/sdb1
Refresh after formatting
Re-read metadata of the new file system.
sudo mkfs.ext4 /dev/sdb1
sudo blkid -g
sudo blkid /dev/sdb1