1BLKID(8)                     System Administration                    BLKID(8)
2
3
4

NAME

6       blkid - locate/print block device attributes
7

SYNOPSIS

9       blkid --label label | --uuid uuid
10
11       blkid [--no-encoding --garbage-collect --list-one --cache-file file]
12       [--output format] [--match-tag tag] [--match-token NAME=value]
13       [device...]
14
15       blkid --probe [--offset offset] [--output format] [--size size]
16       [--match-tag tag] [--match-types list] [--usages list]
17       [--no-part-details] device...
18
19       blkid --info [--output format] [--match-tag tag] device...
20

DESCRIPTION

22       The blkid program is the command-line interface to working with the
23       libblkid(3) library. It can determine the type of content (e.g.,
24       filesystem or swap) that a block device holds, and also the attributes
25       (tokens, NAME=value pairs) from the content metadata (e.g., LABEL or
26       UUID fields).
27
28       It is recommended to use lsblk(8) command to get information about
29       block devices, or lsblk --fs to get an overview of filesystems, or
30       findmnt(8) to search in already mounted filesystems.
31
32          lsblk(8) provides more information, better control on output
33          formatting, easy to use in scripts and it does not require
34          root permissions to get actual information. blkid reads
35          information directly from devices and for non-root users it
36          returns cached unverified information. blkid is mostly
37          designed for system services and to test libblkid(3)
38          functionality.
39
40       When device is specified, tokens from only this device are displayed.
41       It is possible to specify multiple device arguments on the command
42       line. If none is given, all partitions or unpartitioned devices which
43       appear in /proc/partitions are shown, if they are recognized.
44
45       blkid has two main forms of operation: either searching for a device
46       with a specific NAME=value pair, or displaying NAME=value pairs for one
47       or more specified devices.
48
49       For security reasons blkid silently ignores all devices where the
50       probing result is ambivalent (multiple colliding filesystems are
51       detected). The low-level probing mode (-p) provides more information
52       and extra exit status in this case. It’s recommended to use wipefs(8)
53       to get a detailed overview and to erase obsolete stuff (magic strings)
54       from the device.
55

OPTIONS

57       The size and offset arguments may be followed by the multiplicative
58       suffixes like KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB,
59       PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same
60       meaning as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so
61       on for GB, TB, PB, EB, ZB and YB.
62
63       -c, --cache-file cachefile
64           Read from cachefile instead of reading from the default cache file
65           (see the CONFIGURATION FILE section for more details). If you want
66           to start with a clean cache (i.e., don’t report devices previously
67           scanned but not necessarily available at this time), specify
68           /dev/null.
69
70       -d, --no-encoding
71           Don’t encode non-printing characters. The non-printing characters
72           are encoded by ^ and M- notation by default. Note that the --output
73           udev output format uses a different encoding which cannot be
74           disabled.
75
76       -D, --no-part-details
77           Don’t print information (PART_ENTRY_* tags) from partition table in
78           low-level probing mode.
79
80       -g, --garbage-collect
81           Perform a garbage collection pass on the blkid cache to remove
82           devices which no longer exist.
83
84       -H, --hint setting
85           Set probing hint. The hints are an optional way to force probing
86           functions to check, for example, another location. The currently
87           supported is "session_offset=number" to set session offset on
88           multi-session UDF.
89
90       -i, --info
91           Display information about I/O Limits (aka I/O topology). The
92           'export' output format is automatically enabled. This option can be
93           used together with the --probe option.
94
95       -k, --list-filesystems
96           List all known filesystems and RAIDs and exit.
97
98       -l, --list-one
99           Look up only one device that matches the search parameter specified
100           with the --match-token option. If there are multiple devices that
101           match the specified search parameter, then the device with the
102           highest priority is returned, and/or the first device found at a
103           given priority (but see below note about udev). Device types in
104           order of decreasing priority are: Device Mapper, EVMS, LVM, MD, and
105           finally regular block devices. If this option is not specified,
106           blkid will print all of the devices that match the search
107           parameter.
108
109           This option forces blkid to use udev when used for LABEL or UUID
110           tokens in --match-token. The goal is to provide output consistent
111           with other utils (like mount(8), etc.) on systems where the same
112           tag is used for multiple devices.
113
114       -L, --label label
115           Look up the device that uses this filesystem label; this is equal
116           to --list-one --output device --match-token LABEL=label. This
117           lookup method is able to reliably use /dev/disk/by-label udev
118           symlinks (dependent on a setting in /etc/blkid.conf). Avoid using
119           the symlinks directly; it is not reliable to use the symlinks
120           without verification. The --label option works on systems with and
121           without udev.
122
123           Unfortunately, the original blkid(8) from e2fsprogs uses the -L
124           option as a synonym for -o list. For better portability, use -l -o
125           device -t LABEL=label and -o list in your scripts rather than the
126           -L option.
127
128       -n, --match-types list
129           Restrict the probing functions to the specified (comma-separated)
130           list of superblock types (names). The list items may be prefixed
131           with "no" to specify the types which should be ignored. For
132           example:
133
134           blkid --probe --match-types vfat,ext3,ext4 /dev/sda1
135
136           probes for vfat, ext3 and ext4 filesystems, and
137
138           blkid --probe --match-types nominix /dev/sda1
139
140           probes for all supported formats except minix filesystems. This
141           option is only useful together with --probe.
142
143       -o, --output format
144           Use the specified output format. Note that the order of variables
145           and devices is not fixed. See also option -s. The format parameter
146           may be:
147
148           full
149               print all tags (the default)
150
151           value
152               print the value of the tags
153
154           list
155               print the devices in a user-friendly format; this output format
156               is unsupported for low-level probing (--probe or --info).
157
158               This output format is DEPRECATED in favour of the lsblk(8)
159               command.
160
161           device
162               print the device name only; this output format is always
163               enabled for the --label and --uuid options
164
165           udev
166               print key="value" pairs for easy import into the udev
167               environment; the keys are prefixed by ID_FS_ or ID_PART_
168               prefixes. The value may be modified to be safe for udev
169               environment; allowed is plain ASCII, hex-escaping and valid
170               UTF-8, everything else (including whitespaces) is replaced with
171               '_'. The keys with _ENC postfix use hex-escaping for unsafe
172               chars.
173
174               The udev output returns the ID_FS_AMBIVALENT tag if more
175               superblocks are detected, and ID_PART_ENTRY_* tags are always
176               returned for all partitions including empty partitions.
177
178               This output format is DEPRECATED.
179
180           export
181               print key=value pairs for easy import into the environment;
182               this output format is automatically enabled when I/O Limits
183               (--info option) are requested.
184
185               The non-printing characters are encoded by ^ and M- notation
186               and all potentially unsafe characters are escaped.
187
188       -O, --offset offset
189           Probe at the given offset (only useful with --probe). This option
190           can be used together with the --info option.
191
192       -p, --probe
193           Switch to low-level superblock probing mode (bypassing the cache).
194
195           Note that low-level probing also returns information about
196           partition table type (PTTYPE tag) and partitions (PART_ENTRY_*
197           tags). The tag names produced by low-level probing are based on
198           names used internally by libblkid and it may be different than when
199           executed without --probe (for example PART_ENTRY_UUID= vs
200           PARTUUID=). See also --no-part-details.
201
202       -s, --match-tag tag
203           For each (specified) device, show only the tags that match tag. It
204           is possible to specify multiple --match-tag options. If no tag is
205           specified, then all tokens are shown for all (specified) devices.
206           In order to just refresh the cache without showing any tokens, use
207           --match-tag none with no other options.
208
209       -S, --size size
210           Override the size of device/file (only useful with --probe).
211
212       -t, --match-token NAME=value
213           Search for block devices with tokens named NAME that have the value
214           value, and display any devices which are found. Common values for
215           NAME include TYPE, LABEL, and UUID. If there are no devices
216           specified on the command line, all block devices will be searched;
217           otherwise only the specified devices are searched.
218
219       -u, --usages list
220           Restrict the probing functions to the specified (comma-separated)
221           list of "usage" types. Supported usage types are: filesystem, raid,
222           crypto and other. The list items may be prefixed with "no" to
223           specify the usage types which should be ignored. For example:
224
225           blkid --probe --usages filesystem,other /dev/sda1
226
227           probes for all filesystem and other (e.g., swap) formats, and
228
229           blkid --probe --usages noraid /dev/sda1
230
231           probes for all supported formats except RAIDs. This option is only
232           useful together with --probe.
233
234       -U, --uuid uuid
235           Look up the device that uses this filesystem uuid. For more details
236           see the --label option.
237
238       -h, --help
239           Display help text and exit.
240
241       -V, --version
242           Print version and exit.
243

EXIT STATUS

245       If the specified device or device addressed by specified token (option
246       --match-token) was found and it’s possible to gather any information
247       about the device, an exit status 0 is returned. Note the option
248       --match-tag filters output tags, but it does not affect exit status.
249
250       If the specified token was not found, or no (specified) devices could
251       be identified, or it is impossible to gather any information about the
252       device identifiers or device content an exit status of 2 is returned.
253
254       For usage or other errors, an exit status of 4 is returned.
255
256       If an ambivalent probing result was detected by low-level probing mode
257       (-p), an exit status of 8 is returned.
258

CONFIGURATION FILE

260       The standard location of the /etc/blkid.conf config file can be
261       overridden by the environment variable BLKID_CONF. The following
262       options control the libblkid library:
263
264       SEND_UEVENT=<yes|not>
265           Sends uevent when /dev/disk/by-{label,uuid,partuuid,partlabel}/
266           symlink does not match with LABEL, UUID, PARTUUID or PARTLABEL on
267           the device. Default is "yes".
268
269       CACHE_FILE=<path>
270           Overrides the standard location of the cache file. This setting can
271           be overridden by the environment variable BLKID_FILE. Default is
272           /run/blkid/blkid.tab, or /etc/blkid.tab on systems without a /run
273           directory.
274
275       EVALUATE=<methods>
276           Defines LABEL and UUID evaluation method(s). Currently, the
277           libblkid library supports the "udev" and "scan" methods. More than
278           one method may be specified in a comma-separated list. Default is
279           "udev,scan". The "udev" method uses udev /dev/disk/by-* symlinks
280           and the "scan" method scans all block devices from the
281           /proc/partitions file.
282

ENVIRONMENT

284       Setting LIBBLKID_DEBUG=all enables debug output.
285

AUTHORS

287       blkid was written by Andreas Dilger for libblkid and improved by
288       Theodore Ts’o and Karel Zak.
289

SEE ALSO

291       libblkid(3), findfs(8), lsblk(8), wipefs(8)
292

REPORTING BUGS

294       For bug reports, use the issue tracker at
295       https://github.com/util-linux/util-linux/issues.
296

AVAILABILITY

298       The blkid command is part of the util-linux package which can be
299       downloaded from Linux Kernel Archive
300       <https://www.kernel.org/pub/linux/utils/util-linux/>.
301
302
303
304util-linux 2.38.1                 2022-05-11                          BLKID(8)
Impressum