TrumanWong

blkid

Check the file system type, LABEL, UUID and other information of the block device

Supplementary instructions

Under Linux, you can use the blkid command to query the file system type used on the query device. blkid is mainly used to query the file system type, LABEL, UUID and other information used by the system's block devices (including swap partitions). To use this command the e2fsprogs package must be installed.

grammar

blkid -L | -U
blkid [-c ] [-ghlLv] [-o] [-s ][-t ] -[w ] [ ...]
blkid -p [-s ] [-O ] [-S ][-o] ...
blkid -i [-s ] [-o] ...

Options

-c <file> #Specify cache file (default: /etc/blkid.tab, /dev/null = none)
-d # don't encode non-printing characters
-h # Display help information
-g # garbage collect the blkid cache
-o <format> #Specify output format
-k # list all known filesystems/RAIDs and exit
-s <tag> #Display specified information. By default, all information is displayed.
-t <token> # find device with a specific token (NAME=value pair)
-l # look up only first device with token specified by -t
-L <label> # convert LABEL to device name
-U <uuid> # convert UUID to device name
-v # Display version information
-w <file> # write cache to different file (/dev/null = no write)
<dev> # specify device(s) to probe (default: all devices)
Low-level probing options:
-p # low-level superblocks probing (bypass cache)
-i # gather information about I/O limits
-S <size> # overwrite device size
-O <offset> # probe at the given offset
-u <list> # filter by "usage" (e.g. -u filesystem,raid)
-n <list> # filter by filesystem type (e.g. -n vfat,ext3)

Example

  1. List the types of all mounted file systems in the current system:
sudo blkid
  1. Display the specified device UUID:
sudo blkid -s UUID /dev/sda5
  1. Display all device UUIDs:
sudo blkid -s UUID
  1. Display the specified device LABEL:
sudo blkid -s LABEL /dev/sda5
  1. Display all devices LABEL:
sudo blkid -s LABEL
  1. Display all device file systems:
sudo blkid -s TYPE
  1. Show all devices:
sudo blkid -o device
  1. View detailed information in list form:
sudo blkid -o list