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