blkid Command
Intermediate Disk & Storage man(1)Locate/print block device attributes
👁 9 views
📅 Updated: Mar 15, 2026
SYNTAX
blkid [OPTION]... [DEVICE]
What Does blkid Do?
blkid displays block device attributes including filesystem type, UUID, label, and partition type. It identifies what type of data is on each partition.
blkid is essential for finding UUIDs needed for /etc/fstab entries. Using UUIDs instead of device names (/dev/sdX) ensures mounts are reliable even if device names change.
blkid can identify many filesystem types including ext4, xfs, btrfs, swap, FAT, NTFS, LVM, and LUKS encrypted volumes.
blkid is essential for finding UUIDs needed for /etc/fstab entries. Using UUIDs instead of device names (/dev/sdX) ensures mounts are reliable even if device names change.
blkid can identify many filesystem types including ext4, xfs, btrfs, swap, FAT, NTFS, LVM, and LUKS encrypted volumes.
Options & Flags
| Option | Description | Example |
|---|---|---|
| (no args) | Show all block devices with attributes | sudo blkid |
| /dev/sdX | Show attributes for specific device | sudo blkid /dev/sda1 |
| -o list | Show in list format | sudo blkid -o list |
| -s UUID | Show only UUID | sudo blkid -s UUID /dev/sda1 |
| -t TYPE= | Search by attribute | sudo blkid -t TYPE=swap |
Practical Examples
#1 Show all block devices
Lists all partitions with their UUID, type, and label.
$ sudo blkid
Output:
/dev/sda1: UUID="abc-123" TYPE="ext4" LABEL="root"
/dev/sda2: UUID="def-456" TYPE="swap"
#2 Get UUID for fstab
Shows just the UUID value — perfect for pasting into /etc/fstab.
$ sudo blkid -s UUID -o value /dev/sdb1
Output:
a1b2c3d4-e5f6-7890-abcd-ef1234567890
#3 List format
Shows device info in a readable table format.
$ sudo blkid -o list#4 Find swap partitions
Finds all swap partitions on the system.
$ sudo blkid -t TYPE=swap#5 Specific device
Shows attributes for a specific partition.
$ sudo blkid /dev/sda1Tips & Best Practices
Use UUIDs in /etc/fstab: UUID=xxx is more reliable than /dev/sdX in fstab. Device names can change; UUIDs never change.
blkid vs lsblk -f: Both show filesystem info. blkid shows more attributes (PARTUUID, etc.). lsblk -f shows the device tree.
Requires root for all devices: Without root, blkid may not show all devices. Use sudo for complete information.
Frequently Asked Questions
How do I find a partition UUID?
sudo blkid /dev/sdX1 shows the UUID. Or sudo blkid -s UUID -o value /dev/sdX1 for just the value.
Why use UUID instead of /dev/sdX?
Device names can change when drives are added/removed. UUID never changes, making /etc/fstab entries reliable.
How do I identify the filesystem type?
sudo blkid /dev/sdX1 shows the TYPE field. Or use file -s /dev/sdX1.
Related Commands
More Disk & Storage Commands
Master Linux with Professional eBooks
Curated IT eBooks covering Linux, DevOps, Cloud, and more
Browse Books →