21 November 2014
1 min read

Linux blkid Command to Find Block Devices Details

The blkid program is a command-line utility that displays information about available block devices. It can determine the type of content (e.g. filesystem, swap) a block device holds and also attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).

In this tutorial we learn about blkid command in Linux and how to use it to find UUIDs.

blkid usage

Simply running blkid without any argument will list all the available devices with their Universally Unique Identifier (UUID), the TYPE of the file-system and the LABEL if it’s set.

# blkid
blkid

Listing device UUID

If you wish to have information displayed only for a specific device you can use the device name as an option after blkid to do so:

# blkid /dev/sda1

Also if you know the UUID of a device but don’t know the device name and wish to find it out you can use the 0-U option like this:

# blkid -U d3b1dcc2-e3b0-45b0-b703-d6d0d360e524

If you wish to obtain mode detailed information you can use the -p and -o udev option to have it display in a nice format like this:

# blkid -po udev /dev/sda1

Sometimes the device list might not be updated, if you think this is the case you can use the -g option that will perform a garbage collection pass on the blkid cache to remove devices which no longer exist.

# blkid -g

Conclusion

In this tutorial, we learned blkid command and how to use it to list block device details. Blkid is mainly used to list disk/partitions UUID.

Bobbin Zachariah

Bobbin Zachariah

Bobbin Zachariah is the editor-in-chief of Linoxide and has an experienced team of Linux enthusiastic authors who makes this blog awesome. Linoxide is one of the top 20 Linux Blog by whizlabs.

Leave a Reply

Your email address will not be published.

Previous Story

15 Linux ps Command with Examples

Next Story

4 Steps to Setup Local Repository in Ubuntu using APT-mirror

Latest from Blog

Top 8 Reasons to Use Garuda Linux

Have you been going back and forth between multiple Linux flavors in search of an exciting experience? Or perhaps you are coming from a Windows or MAC environment and want to try

How to Rename Multiple Files in Linux

In a Linux system, you can easily rename a file using mv command. But, if you have multiple files which you want to rename, in this situation you need some extra tools

How to Install TensorFlow on Ubuntu 20.04

Tensorflow is an open-source platform for machine learning and artificial intelligence. It is developed by the Google Brain team. It contains tools, libraries, and community resources for developers to build ML powered
Go toTop