blkid -L label | -U uuid
blkid [-dghlv] [-c file] [-o format] [-s tag] [-t NAME=value] [device ...]
blkid -p [-O offset] [-o format] [-S size] [-s tag] [-n list] [-u list] device ...
blkid -i [-o format] [-s tag] device ...
The blkid program is the command-line interface to working with the libblkid(3) library. It can determine the type of content (e.g. filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).
It is recommended to use lsblk(8) command to get information about block devices rather than blkid. lsblk(8) provides more information, better control on output formatting and it does not require root permissions to get actual information.
When device is specified, tokens from only this device are displayed. It is possible to specify multiple device arguments on the command line. If none is given, all devices which appear in /proc/partitions are shown, if they are recognized.
Note that blkid reads information directly from devices and for non-root users it returns cached unverified information. It is better to use lsblk --fs to get a user-friendly overview of filesystems and devices. lsblk(8) is also easy to use in scripts. blkid is mostly designed for system services and to test libblkid functionality.
blkid has two main forms of operation: either searching for a device with a specific NAME=value pair, or displaying NAME=value pairs for one or more specified devices.
The size and offset arguments may be followed by the multiplicative suffixes like KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g. "K" has the same meaning as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
Unfortunately, the original blkid(8) from e2fsprogs uses the -L option as a synonym for -o list. For better portability, use -l -o device -t LABEL=label and -o list in your scripts rather than the -L option.
blkid -p -n vfat,ext3,ext4 /dev/sda1
probes for vfat, ext3 and ext4 filesystems, and
blkid -p -n nominix /dev/sda1
probes for all supported formats except minix filesystems. This option is only useful together with -p.
This output format is DEPRECATED in favour of the lsblk(8) command.
The udev output returns the ID_FS_AMBIVALENT tag if more superblocks are detected, and ID_PART_ENTRY_* tags are always returned for all partitions including empty partitions. This output format is DEPRECATED.
The non-printing characters are encoded by ^ and M- notation and all potentially unsafe characters are escaped.
Note that low-level probing also returns information about partition table type (PTTYPE tag) and partitions (PART_ENTRY_* tags). The tag names produced by low-level probing are based on names used internally by libblkid and it may be different than when executed without -p (for example PART_ENTRY_UUID= vs PARTUUID=).
blkid -p -u filesystem,other /dev/sda1
probes for all filesystem and other (e.g. swap) formats, and
blkid -p -u noraid /dev/sda1
probes for all supported formats except RAIDs. This option is only useful together with -p.
If the specified device or device addressed by specified token (option -t) was found and it's possible to gather any information about the device, an exit code 0 is returned. Note the option -s filters output tags, but it does not affect return code.
If the specified token was not found, or no (specified) devices could be identified, an exit code of 2 is returned.
For usage or other errors, an exit code of 4 is returned.
If an ambivalent low-level probing result was detected, an exit code of 8 is returned.
The standard location of the /etc/blkid.conf config file can be overridden by the environment variable BLKID_CONF. The following options control the libblkid library:
blkid was written by Andreas Dilger for libblkid and improved by Theodore Ts'o and Karel Zak.
libblkid(3), findfs(8), wipefs(8), lsblk(8),
The blkid command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.