BLKID
The BLKID command outputs information about connected devices/partitions.
For each block device blkid displays attributes such as its UUID, TYPE, and LABEL. A block device may be a HDD, SSD, or a USB drive. BLKID can also determine the content type of a block device (file system, swap).
BLKID is part of the standard Util-Linux package installed with most distributions:
sudo pacman -S util-linux
BLKID Options
Command options
Command options modify the behaviour of blkid
.
Option | Description |
---|---|
-c , --cache-file <file> |
read from file instead of the default cache( -c /dev/null for no cache) |
-d , --no-encoding |
don’t encode non-printing characters |
-g , --garbage-collect |
remove non-existent devices from the blkid cache |
-o , --output <format> |
output the specified format token:value - output value of the tags;device - output device name only;export - output device name only;list - output devices in a list format;full - output all tags (default) |
-k , --list-filesystems |
list all known filesystems and RAIDs and exit |
-s , --match-tag <TAG> |
show specified tag(s); (default: show all)LABEL , BLOCK_SIZE , UUID , TYPE , PARTLABEL , PARTUUID |
-t , --match-token <NAME=value> |
find device with a specific NAME token; Valid tokens include: LABEL , TYPE or UUID |
-l , --list-one |
look up only first device with token specified by -t |
-L , --label <label> |
convert LABEL to device name/node |
-U , --uuid <uuid> |
convert filesystem UUID to device name/node |
-h , --help |
display usage information and exit |
-V , --version |
display blkid version information |
Low-level probing
Option | Description |
---|---|
-p , --probe <device> |
low-level superblocks probing (bypass cache) |
-i , --info <device> |
gather information about I/O limits |
-H , --hint <value> |
set hint for probing function |
-S , --size <size> |
overwrite device size |
-O , --offset <offset> |
probe at the given offset |
-u , --usages <list> |
filter by usage (e.g. -u filesystem,raid ) |
-n , --match-types <list> |
filter by filesystem type (e.g. -n vfat,ext4 ) |
-D , --no-part-details |
don’t print info from partition table |
BLKID commands in Linux
sudo blkid
The command sudo blkid
(without arguments) and sudo blkid -o full
are functionally equivalent; both output full details of all available devices.
sudo blkid
/dev/sdXY
Display information about a single device
sudo blkid /dev/sdXY
Example output:
[nix@nix ~]$ sudo blkid /dev/sdb3
/dev/sdb3: LABEL="WINDATA" BLOCK_SIZE="512" UUID="5AEA245202EA25E1" TYPE="ntfs" PARTLABEL="WINDATA_VM" PARTUUID="76467445-967b-463c-865f-a0640117976f"
-c
, --cache-file <file>
Read from file
instead of the default cache (-c /dev/null
for no cache)
sudo blkid -c /path/to/cache/file
sudo blkid -c /dev/null
-d
, --no-encoding
Don’t encode non-printing characters
sudo blkid -d
-g
, --garbage-collect
Remove non-existent devices from the blkid cache
sudo blkid -g
Output token examples
The -o
option (with a predefined token) modifies the output;
Valid tokens include:
Token | Description |
---|---|
value |
output value of the tags |
device |
output device name only |
export |
output device name only |
list |
output devices in a list format |
full |
output all tags (default) |
-o
, --output value
Output list of the tags with value token
sudo blkid -o value
Example output:
[nix@nix ~]$ sudo blkid -o value
ESP_MAN
ESP_MAN
2B21-157F
512
vfat
EFI system partition
7c1fe208-ce71-45da-bc93-d310e11b9b00
swap
7175d2c1-2ffd-4d8a-b6f8-7140f4d32d23
swap
f945587b-1da9-4cec-85e4-ccc929a8c88d
MANJARO
14684cf5-fa49-45c2-bba6-87902b4a8130
4096
ext4
6e126a1f-caaf-4b62-930c-7703e6c22c94
MANHOME
1bf95423-e9de-435d-b739-4a270d2e5079
4096
ext4
1cfec459-4dfd-4c6a-afc9-2ce8a948f1dc
ESP_EXT
ESP_EXT
B340-10B9
512
vfat
EFI system partition
1558afe3-073b-4f52-aa52-c79cfe2d1b68
MANDATA
7fac5ef5-c05e-4d9e-b937-fc1680e8757d
4096
ext4
MANDATA_DB
3b6af8cc-a23a-4caa-a4e2-6e334863f8ed
WINDATA
512
5AEA245202EA25E1
ntfs
WINDATA_VM
76467445-967b-463c-865f-a0640117976f
ESP_USB
ESP_USB
52C6-B274
512
vfat
EFI system partition
bc584cee-1276-4834-aac9-1960824094a7
USBDATA
512
BDDC37ED7B5444C0
ntfs
USBDATA_EX
6353889d-7ecb-4ffb-88d1-ea04f8d3fb07
-o
, --output device
Output list of the tags using the device token
sudo blkid -o device
Example output:
[nix@nix ~]$ sudo blkid -o device
/dev/sda1
/dev/sda2
/dev/sda3
/dev/sda4
/dev/sdb1
/dev/sdb2
/dev/sdb3
/dev/sdc1
/dev/sdc2
-o
, --output export
Output list of tags formatted using the export token
sudo blkid -o export
Example output:
[nix@nix ~]$ sudo blkid -o export
DEVNAME=/dev/sda1
LABEL_FATBOOT=ESP_MAN
LABEL=ESP_MAN
UUID=2B21-157F
BLOCK_SIZE=512
TYPE=vfat
PARTLABEL=EFI system partition
PARTUUID=7c1fe208-ce71-45da-bc93-d310e11b9b00
DEVNAME=/dev/sda2
LABEL=swap
UUID=7175d2c1-2ffd-4d8a-b6f8-7140f4d32d23
TYPE=swap
PARTUUID=f945587b-1da9-4cec-85e4-ccc929a8c88d
DEVNAME=/dev/sda3
LABEL=MANJARO
UUID=14684cf5-fa49-45c2-bba6-87902b4a8130
BLOCK_SIZE=4096
TYPE=ext4
PARTUUID=6e126a1f-caaf-4b62-930c-7703e6c22c94
DEVNAME=/dev/sda4
LABEL=MANHOME
UUID=1bf95423-e9de-435d-b739-4a270d2e5079
BLOCK_SIZE=4096
TYPE=ext4
PARTUUID=1cfec459-4dfd-4c6a-afc9-2ce8a948f1dc
DEVNAME=/dev/sdb1
LABEL_FATBOOT=ESP_EXT
LABEL=ESP_EXT
BLOCK_SIZE=512
UUID=B340-10B9
TYPE=vfat
PARTLABEL=EFI system partition
PARTUUID=1558afe3-073b-4f52-aa52-c79cfe2d1b68
DEVNAME=/dev/sdb2
LABEL=MANDATA
UUID=7fac5ef5-c05e-4d9e-b937-fc1680e8757d
BLOCK_SIZE=4096
TYPE=ext4
PARTLABEL=MANDATA_DB
PARTUUID=3b6af8cc-a23a-4caa-a4e2-6e334863f8ed
DEVNAME=/dev/sdb3
LABEL=WINDATA
BLOCK_SIZE=512
UUID=5AEA245202EA25E1
TYPE=ntfs
PARTLABEL=WINDATA_VM
PARTUUID=76467445-967b-463c-865f-a0640117976f
DEVNAME=/dev/sdc1
LABEL_FATBOOT=ESP_USB
LABEL=ESP_USB
UUID=52C6-B274
BLOCK_SIZE=512
TYPE=vfat
PARTLABEL=EFI System Partition
PARTUUID=bc584cee-1276-4834-aac9-1960824094a7
DEVNAME=/dev/sdc2
LABEL=USBDATA
BLOCK_SIZE=512
UUID=BDDC37ED7B5444C0
TYPE=ntfs
PARTLABEL=USBDATA_EX
PARTUUID=6353889d-7ecb-4ffb-88d1-ea04f8d3fb07
-o
, --output list
Output list of devices in tabular format using the list token
sudo blkid -o list
Example output:
[nix@nix ~]$ sudo blkid -o list
device fs_type label mount point UUID
-------------------------------------------------------------------------------------------------------------
/dev/sda1 vfat ESP_MAN /boot/efi 2B21-157F
/dev/sda2 swap swap [SWAP] 7175d2c1-2ffd-4d8a-b6f8-7140f4d32d23
/dev/sda3 ext4 MANJARO / 14684cf5-fa49-45c2-bba6-87902b4a8130
/dev/sda4 ext4 MANHOME /home 1bf95423-e9de-435d-b739-4a270d2e5079
/dev/sdb1 vfat ESP_EXT [none] B340-10B9
/dev/sdb2 ext4 MANDATA /media/mandata 7fac5ef5-c05e-4d9e-b937-fc1680e8757d
/dev/sdb3 ntfs WINDATA /media/windata 5AEA245202EA25E1
/dev/sdc1 vfat ESP_USB [none] 52C6-B274
/dev/sdc2 ntfs USBDATA /run/media/nix/usbdata BDDC37ED7B5444C0
-o
, --output full
Output a list of tags using the full token (default: all tags)
- The default output is unordered and unsorted.
sudo blkid -o full
Example output:
[nix@nix ~]$ sudo blkid -o full
/dev/sda1: LABEL_FATBOOT="ESP_MAN" LABEL="ESP_MAN" UUID="2B21-157F" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="7c1fe208-ce71-45da-bc93-d310e11b9b00"
/dev/sda2: LABEL="swap" UUID="7175d2c1-2ffd-4d8a-b6f8-7140f4d32d23" TYPE="swap" PARTUUID="f945587b-1da9-4cec-85e4-ccc929a8c88d"
/dev/sda3: LABEL="MANJARO" UUID="14684cf5-fa49-45c2-bba6-87902b4a8130" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6e126a1f-caaf-4b62-930c-7703e6c22c94"
/dev/sda4: LABEL="MANHOME" UUID="1bf95423-e9de-435d-b739-4a270d2e5079" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="1cfec459-4dfd-4c6a-afc9-2ce8a948f1dc"
/dev/sdb1: LABEL_FATBOOT="ESP_EXT" LABEL="ESP_EXT" UUID="B340-10B9" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="1558afe3-073b-4f52-aa52-c79cfe2d1b68"
/dev/sdb2: LABEL="MANDATA" UUID="7fac5ef5-c05e-4d9e-b937-fc1680e8757d" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="MANDATA_DB" PARTUUID="3b6af8cc-a23a-4caa-a4e2-6e334863f8ed"
/dev/sdb3: LABEL="WINDATA" BLOCK_SIZE="512" UUID="5AEA245202EA25E1" TYPE="ntfs" PARTLABEL="WINDATA_VM" PARTUUID="76467445-967b-463c-865f-a0640117976f"
/dev/sdc1: LABEL_FATBOOT="ESP_USB" LABEL="ESP_USB" UUID="52C6-B274" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="bc584cee-1276-4834-aac9-1960824094a7"
/dev/sdc2: LABEL="USBDATA" BLOCK_SIZE="512" UUID="BDDC37ED7B5444C0" TYPE="ntfs" PARTLABEL="USBDATA_EX" PARTUUID="6353889d-7ecb-4ffb-88d1-ea04f8d3fb07"
-k
, --list-filesystems
List all known filesystems and RAIDs and exit
sudo blkid -k
Match-tag examples
Shows the specified matching tag(s), (default: show all);
Valid tags include:
Tag | Description |
---|---|
LABEL_FATBOOT |
ESP |
LABEL |
Volume label |
BLOCK_SIZE |
Partition block size |
UUID |
Volume UUID |
TYPE |
File system type |
PARTLABEL |
Partition label |
PARTUUID |
Partition UUID |
-s
, --match-tag LABEL_FATBOOT
Match devices with the LABEL_FATBOOT tag:
sudo blkid -s LABEL_FATBOOT
Example output:
[nix@nix ~]$ sudo blkid -s LABEL_FATBOOT
/dev/sda1: LABEL_FATBOOT="ESP_MAN"
/dev/sdb1: LABEL_FATBOOT="ESP_EXT"
/dev/sdc1: LABEL_FATBOOT="ESP_USB"
-s
, --match-tag LABEL
Match devices with the LABEL tag:
sudo blkid -s LABEL
Example output:
[nix@nix ~]$ sudo blkid -s LABEL
/dev/sda1: LABEL="ESP_MAN"
/dev/sda2: LABEL="swap"
/dev/sda3: LABEL="MANJARO"
/dev/sda4: LABEL="MANHOME"
/dev/sdb1: LABEL="ESP_EXT"
/dev/sdb2: LABEL="MANDATA"
/dev/sdb3: LABEL="WINDATA"
/dev/sdc1: LABEL="ESP_USB"
/dev/sdc2: LABEL="USBDATA"
-s
, --match-tag BLOCK_SIZE
Match devices with the BLOCK_SIZE tag:
sudo blkid -s BLOCK_SIZE
Example output:
[nix@nix ~]$ sudo blkid -s BLOCK_SIZE
/dev/sda1: BLOCK_SIZE="512"
# /dev/sda2 is SWAP
/dev/sda3: BLOCK_SIZE="4096"
/dev/sda4: BLOCK_SIZE="4096"
/dev/sdb1: BLOCK_SIZE="512"
/dev/sdb2: BLOCK_SIZE="4096"
/dev/sdb3: BLOCK_SIZE="4096"
/dev/sdc1: BLOCK_SIZE="512"
/dev/sdc2 BLOCK_SIZE="512"
-s
, --match-tag UUID
Match devices with the UUID tag:
sudo blkid -s UUID
Example output:
[nix@nix ~]$ sudo blkid -s UUID
/dev/sda1: UUID="2B21-157F"
/dev/sda3: UUID="7175d2c1-2ffd-4d8a-b6f8-7140f4d32d23"
/dev/sda3: UUID="14684cf5-fa49-45c2-bba6-87902b4a8130"
/dev/sda4: UUID="1bf95423-e9de-435d-b739-4a270d2e5079"
/dev/sdb1: UUID="B340-10B9"
/dev/sdb2: UUID="7fac5ef5-c05e-4d9e-b937-fc1680e8757d"
/dev/sdb3: UUID="5AEA245202EA25E1"
/dev/sdc1: UUID="52C6-B274"
/dev/sdc2: UUID="BDDC37ED7B5444C0"
-s
, --match-tag TYPE
Match devices with the TYPE tag:
sudo blkid -s TYPE
Example output:
[nix@nix ~]$ sudo blkid -s TYPE
/dev/sde1: TYPE="vfat"
/dev/sde2: TYPE="swap"
/dev/sde3: TYPE="ext4"
/dev/sde4: TYPE="ext4"
/dev/sdb1: TYPE="vfat"
/dev/sdb2: TYPE="ext4"
/dev/sdb3: TYPE="ntfs"
/dev/sdc1: TYPE="vfat"
/dev/sdc2: TYPE="ntfs"
-s
, --match-tag PARTLABEL
Match devices with the PARTLABEL tag:
sudo blkid -s PARTLABEL
Example output:
[nix@nix ~]$ sudo blkid -s PARTLABEL
/dev/sda1: PARTLABEL="EFI System Partition"
# /dev/sda2 has no PARTLABEL defined
# /dev/sda3 has no PARTLABEL defined
# /dev/sda4 has no PARTLABEL defined
/dev/sdb1: PARTLABEL="EFI system partition"
/dev/sdb2: PARTLABEL="MANDATA_DB"
/dev/sdb3: PARTLABEL="WINDATA_VM"
/dev/sdc1: PARTLABEL="EFI system partition"
/dev/sdc2: PARTLABEL="USB-SEAGATE"
-s
, --match-tag PARTUUID
Match devices with the PARTUUID tag:
sudo blkid -s PARTUUID
Example output:
[nix@nix ~]$ sudo blkid -s PARTUUID
/dev/sda1: PARTUUID="7c1fe208-ce71-45da-bc93-d310e11b9b00"
/dev/sda2: PARTUUID="f945587b-1da9-4cec-85e4-ccc929a8c88d"
/dev/sda3: PARTUUID="6e126a1f-caaf-4b62-930c-7703e6c22c94"
/dev/sda4: PARTUUID="1cfec459-4dfd-4c6a-afc9-2ce8a948f1dc"
/dev/sdb1: PARTUUID="1558afe3-073b-4f52-aa52-c79cfe2d1b68"
/dev/sdb2: PARTUUID="3b6af8cc-a23a-4caa-a4e2-6e334863f8ed"
/dev/sdb3: PARTUUID="76467445-967b-463c-865f-a0640117976f"
/dev/sdc1: PARTUUID="bc584cee-1276-4834-aac9-1960824094a7"
/dev/sdc2: PARTUUID="6353889d-7ecb-4ffb-88d1-ea04f8d3fb07"
Match-token (NAME=value) pairs
Match device with a specific NAME=value token;
Valid NAME tokens include:
Token | Description |
---|---|
<LABEL=value> |
Volume label |
<TYPE=value> |
File system type |
<UUID=value> |
Volume UUID |
-t
, --match-token <LABEL=value>
Match specific device with the LABEL= token
sudo blkid -t LABEL=WINDATA
Example output:
[nix@nix ~]$ sudo blkid -t LABEL=WINDATA
/dev/sdb3: LABEL="WINDATA" BLOCK_SIZE="512" UUID="5AEA245202EA25E1" TYPE="ntfs" PARTLABEL="WINDATA_VM" PARTUUID="76467445-967b-463c-865f-a0640117976f"
-t
, --match-token <TYPE=value>
Match devices with the TYPE= token
sudo blkid -t TYPE=ntfs
Example output:
[nix@nix ~]$ sudo blkid -t TYPE=ntfs
/dev/sdb3: LABEL="WINDATA" BLOCK_SIZE="512" UUID="5AEA245202EA25E1" TYPE="ntfs" PARTLABEL="WINDATA_VM" PARTUUID="76467445-967b-463c-865f-a0640117976f"
/dev/sdc2: LABEL="USBDATA" BLOCK_SIZE="512" UUID="BDDC37ED7B5444C0" TYPE="ntfs" PARTLABEL="USBDATA_EX" PARTUUID="6353889d-7ecb-4ffb-88d1-ea04f8d3fb07"
-t
, --match-token <UUID=value>
Match specific device with the UUID= token
sudo blkid -t UUID=BDDC37ED7B5444C0
Example output:
[nix@nix ~]$ sudo blkid -t UUID=BDDC37ED7B5444C0
/dev/sdc2: LABEL="USBDATA" BLOCK_SIZE="512" UUID="BDDC37ED7B5444C0" TYPE="ntfs" PARTLABEL="USBDATA_EX" PARTUUID="6353889d-7ecb-4ffb-88d1-ea04f8d3fb07"
-l
, --list-one
Match only the first device using the -t NAME=[value] token
sudo blkid -lt TYPE=ntfs
Example output:
[nix@nix ~]$ sudo blkid -lt TYPE=ntfs
/dev/sdb3: LABEL="WINDATA" BLOCK_SIZE="512" UUID="5AEA245202EA25E1" TYPE="ntfs" PARTLABEL="WINDATA_VM" PARTUUID="76467445-967b-463c-865f-a0640117976f"
-L
, --label <label>
Convert label to device name/node
sudo blkid -L MANDATA
Example output:
[nix@nix ~]$ sudo blkid -L MANDATA
/dev/sdb2
-U
, --uuid <uuid>
Convert filesystem UUID to device name/node
sudo blkid -U 7fac5ef5-c05e-4d9e-b937-fc1680e8757d
Example output:
[nix@nix ~]$ sudo blkid -U 7fac5ef5-c05e-4d9e-b937-fc1680e8757d
/dev/sdb2
-h
, --help
Display usage information and exit
sudo blkid -h
Example output:
[nix@nix ~]$ blkid -h
# DISPLAYS HELP/USAGE INFORMATION
-V
, --version
Display version information
sudo blkid -V
Example output:
[nix@nix ~]$ sudo blkid -V
blkid from util-linux 2.39.2 (libblkid 2.39.2, 17-Aug-2023)
BLKID Low-level probing
-p
, --probe <device>
Low-level superblocks probing (bypass cache)
sudo blkid -p /dev/sdX
Example output:
[nix@nix ~]$ sudo blkid -p /dev/sda
/dev/sda: PTUUID="750f8545-0cd7-318e-9de8-6e01573b2fb9" PTTYPE="gpt"
-i
, --info <device>
Gather information about I/O limits
sudo blkid -i /dev/sdX
Example output:
[nix@nix ~]$ sudo blkid -i /dev/sda
/dev/sda: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" DISKSEQ="5" LOGICAL_SECTOR_SIZE="512"
-H
, --hint <value>
Set hint for probing function
sudo blkid -H
-S
, --size <size>
Overwrite device size
sudo blkid -S [size]
-O
, --offset <offset>
Probe at the given offset
sudo blkid -O [offset]
-u
, --usages <list>
Filter by usage (-u filesystem,raid
)
sudo blkid -u [usages]
-n
, --match-types <list>
Filter by filesystem type (-n vfat,ntfs,ext4
)
sudo blkid -n [list]
-D
, --no-part-details
Don’t print info from partition table
sudo blkid -D
See also: man blkid; man blkid.
Contributors: