-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblkid.8.html
318 lines (318 loc) · 16.8 KB
/
blkid.8.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<!DOCTYPE html>
<html>
<!-- This is an automatically generated file. Do not edit.
t
Title: blkid
Author: [see the "AUTHOR(S)" section]
Generator: Asciidoctor 2.0.20
Date: 2025-01-13
Manual: System Administration
Source: util-linux 2.40.4
Language: English
-->
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="mandoc.css" type="text/css" media="all"/>
<title>BLKID(8)</title>
</head>
<body>
<table class="head">
<tr>
<td class="head-ltitle">BLKID(8)</td>
<td class="head-vol">System Administration</td>
<td class="head-rtitle">BLKID(8)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp">blkid - locate/print block device attributes</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><b>blkid</b> <b>--label</b> <i>label</i> | <b>--uuid</b>
<i>uuid</i></p>
<p class="Pp"><b>blkid</b> [<b>--no-encoding</b> <b>--garbage-collect</b>
<b>--list-one</b> <b>--cache-file</b> <i>file</i>] [<b>--output</b>
<i>format</i>] [<b>--match-tag</b> <i>tag</i>] [<b>--match-token</b>
<i>NAME=value</i>] [<i>device</i>...]</p>
<p class="Pp"><b>blkid</b> <b>--probe</b> [<b>--offset</b> <i>offset</i>]
[<b>--output</b> <i>format</i>] [<b>--size</b> <i>size</i>]
[<b>--match-tag</b> <i>tag</i>] [<b>--match-types</b> <i>list</i>]
[<b>--usages</b> <i>list</i>] [<b>--no-part-details</b>]
<i>device</i>...</p>
<p class="Pp"><b>blkid</b> <b>--info</b> [<b>--output format</b>]
[<b>--match-tag</b> <i>tag</i>] <i>device</i>...</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <b>blkid</b> program is the command-line interface to working
with the <b>libblkid</b>(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).</p>
<p class="Pp"><b>It is recommended to use</b> <b>lsblk</b>(8) <b>command to get
information about block devices, or lsblk --fs to get an overview of
filesystems, or</b> <b>findmnt</b>(8) <b>to search in already mounted
filesystems.</b></p>
<div class="Bd-indent">
<p class="Pp"><b>lsblk</b>(8) provides more information, better control on
output formatting, easy to use in scripts and it does not require root
permissions to get actual information. <b>blkid</b> reads information
directly from devices and for non-root users it returns cached unverified
information. <b>blkid</b> is mostly designed for system services and to test
<b>libblkid</b>(3) functionality.
<br/>
</p>
</div>
<p class="Pp">When <i>device</i> is specified, tokens from only this device are
displayed. It is possible to specify multiple <i>device</i> arguments on the
command line. If none is given, all partitions or unpartitioned devices
which appear in <i>/proc/partitions</i> are shown, if they are
recognized.</p>
<p class="Pp"><b>blkid</b> 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.</p>
<p class="Pp">For security reasons <b>blkid</b> silently ignores all devices
where the probing result is ambivalent (multiple colliding filesystems are
detected). The low-level probing mode (<b>-p</b>) provides more information
and extra exit status in this case. It’s recommended to use
<b>wipefs</b>(8) to get a detailed overview and to erase obsolete stuff
(magic strings) from the device.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="OPTIONS"><a class="permalink" href="#OPTIONS">OPTIONS</a></h1>
<p class="Pp">The <i>size</i> and <i>offset</i> 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.</p>
<p class="Pp"><b>-c</b>, <b>--cache-file</b> <i>cachefile</i></p>
<div class="Bd-indent">Read from <i>cachefile</i> instead of reading from the
default cache file (see the <b>CONFIGURATION FILE</b> section for more
details). If you want to start with a clean cache (i.e., don’t report
devices previously scanned but not necessarily available at this time),
specify <i>/dev/null</i>.</div>
<p class="Pp"><b>-d</b>, <b>--no-encoding</b></p>
<div class="Bd-indent">Don’t encode non-printing characters. The
non-printing characters are encoded by ^ and M- notation by default. Note that
the <b>--output udev</b> output format uses a different encoding which cannot
be disabled.</div>
<p class="Pp"><b>-D</b>, <b>--no-part-details</b></p>
<div class="Bd-indent">Don’t print information (PART_ENTRY_* tags) from
partition table in low-level probing mode.</div>
<p class="Pp"><b>-g</b>, <b>--garbage-collect</b></p>
<div class="Bd-indent">Perform a garbage collection pass on the blkid cache to
remove devices which no longer exist.</div>
<p class="Pp"><b>-H</b>, <b>--hint</b> <i>setting</i></p>
<div class="Bd-indent">Set probing hint. The hints are an optional way to force
probing functions to check, for example, another location. The currently
supported is "session_offset=<i>number</i>" to set session offset on
multi-session UDF.</div>
<p class="Pp"><b>-i</b>, <b>--info</b></p>
<div class="Bd-indent">Display information about I/O Limits (aka I/O topology).
The 'export' output format is automatically enabled. This option can be used
together with the <b>--probe</b> option.</div>
<p class="Pp"><b>-k</b>, <b>--list-filesystems</b></p>
<div class="Bd-indent">List all known filesystems and RAIDs and exit.</div>
<p class="Pp"><b>-l</b>, <b>--list-one</b></p>
<div class="Bd-indent">Look up only one device that matches the search parameter
specified with the <b>--match-token</b> option. If there are multiple devices
that match the specified search parameter, then the device with the highest
priority is returned, and/or the first device found at a given priority (but
see below note about udev). Device types in order of decreasing priority are:
Device Mapper, EVMS, LVM, MD, and finally regular block devices. If this
option is not specified, <b>blkid</b> will print all of the devices that match
the search parameter.
<p class="Pp">This option forces <b>blkid</b> to use udev when used for LABEL or
UUID tokens in <b>--match-token</b>. The goal is to provide output
consistent with other utils (like <b>mount</b>(8), etc.) on systems where
the same tag is used for multiple devices.</p>
</div>
<p class="Pp"><b>-L</b>, <b>--label</b> <i>label</i></p>
<div class="Bd-indent">Look up the device that uses this filesystem
<i>label</i>; this is equal to <b>--list-one --output device --match-token
LABEL=</b><i>label</i>. This lookup method is able to reliably use
/dev/disk/by-label udev symlinks (dependent on a setting in
<i>/etc/blkid.conf</i>). Avoid using the symlinks directly; it is not reliable
to use the symlinks without verification. The <b>--label</b> option works on
systems with and without udev.
<p class="Pp">Unfortunately, the original <b>blkid</b>(8) from e2fsprogs uses
the <b>-L</b> option as a synonym for <b>-o list</b>. For better
portability, use <b>-l -o device -t LABEL=</b><i>label</i> and <b>-o
list</b> in your scripts rather than the <b>-L</b> option.</p>
</div>
<p class="Pp"><b>-n</b>, <b>--match-types</b> <i>list</i></p>
<div class="Bd-indent">Restrict the probing functions to the specified
(comma-separated) <i>list</i> of superblock types (names). The list items may
be prefixed with "no" to specify the types which should be ignored.
For example:
<p class="Pp"><b>blkid --probe --match-types vfat,ext3,ext4 /dev/sda1</b></p>
<p class="Pp">probes for vfat, ext3 and ext4 filesystems, and</p>
<p class="Pp"><b>blkid --probe --match-types nominix /dev/sda1</b></p>
<p class="Pp">probes for all supported formats except minix filesystems. This
option is only useful together with <b>--probe</b>.</p>
</div>
<p class="Pp"><b>-o</b>, <b>--output</b> <i>format</i></p>
<div class="Bd-indent">Use the specified output format. Note that the order of
variables and devices is not fixed. See also option <b>-s</b>. The
<i>format</i> parameter may be:
<p class="Pp"><b>full</b></p>
<div class="Bd-indent">print all tags (the default)</div>
<p class="Pp"><b>value</b></p>
<div class="Bd-indent">print the value of the tags</div>
<p class="Pp"><b>list</b></p>
<div class="Bd-indent">print the devices in a user-friendly format; this output
format is unsupported for low-level probing (<b>--probe</b> or <b>--info</b>).
<p class="Pp">This output format is <b>DEPRECATED</b> in favour of the
<b>lsblk</b>(8) command.</p>
</div>
<p class="Pp"><b>device</b></p>
<div class="Bd-indent">print the device name only; this output format is always
enabled for the <b>--label</b> and <b>--uuid</b> options</div>
<p class="Pp"><b>udev</b></p>
<div class="Bd-indent">print key="value" pairs for easy import into
the udev environment; the keys are prefixed by ID_FS_ or ID_PART_ prefixes.
The value may be modified to be safe for udev environment; allowed is plain
ASCII, hex-escaping and valid UTF-8, everything else (including whitespaces)
is replaced with '_'. The keys with <i>_ENC</i> postfix use hex-escaping for
unsafe chars.
<p class="Pp">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.</p>
<p class="Pp">This output format is <b>DEPRECATED</b>.</p>
</div>
<p class="Pp"><b>export</b></p>
<div class="Bd-indent">print key=value pairs for easy import into the
environment; this output format is automatically enabled when I/O Limits
(<b>--info</b> option) are requested.
<p class="Pp">The non-printing characters are encoded by ^ and M- notation and
all potentially unsafe characters are escaped.</p>
</div>
</div>
<p class="Pp"><b>-O</b>, <b>--offset</b> <i>offset</i></p>
<div class="Bd-indent">Probe at the given <i>offset</i> (only useful with
<b>--probe</b>). This option can be used together with the <b>--info</b>
option.</div>
<p class="Pp"><b>-p</b>, <b>--probe</b></p>
<div class="Bd-indent">Switch to low-level superblock probing mode (bypassing
the cache).
<p class="Pp">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
<b>--probe</b> (for example PART_ENTRY_UUID= vs PARTUUID=). See also
<b>--no-part-details</b>.</p>
</div>
<p class="Pp"><b>-s</b>, <b>--match-tag</b> <i>tag</i></p>
<div class="Bd-indent">For each (specified) device, show only the tags that
match <i>tag</i>. It is possible to specify multiple <b>--match-tag</b>
options. If no tag is specified, then all tokens are shown for all (specified)
devices. In order to just refresh the cache without showing any tokens, use
<b>--match-tag none</b> with no other options.</div>
<p class="Pp"><b>-S</b>, <b>--size</b> <i>size</i></p>
<div class="Bd-indent">Override the size of device/file (only useful with
<b>--probe</b>).</div>
<p class="Pp"><b>-t</b>, <b>--match-token</b> <i>NAME=value</i></p>
<div class="Bd-indent">Search for block devices with tokens named <i>NAME</i>
that have the value <i>value</i>, and display any devices which are found.
Common values for <i>NAME</i> include <b>TYPE</b>, <b>LABEL</b>, and
<b>UUID</b>. If there are no devices specified on the command line, all block
devices will be searched; otherwise only the specified devices are
searched.</div>
<p class="Pp"><b>-u</b>, <b>--usages</b> <i>list</i></p>
<div class="Bd-indent">Restrict the probing functions to the specified
(comma-separated) <i>list</i> of "usage" types. Supported usage
types are: filesystem, raid, crypto and other. The list items may be prefixed
with "no" to specify the usage types which should be ignored. For
example:
<p class="Pp"><b>blkid --probe --usages filesystem,other /dev/sda1</b></p>
<p class="Pp">probes for all filesystem and other (e.g., swap) formats, and</p>
<p class="Pp"><b>blkid --probe --usages noraid /dev/sda1</b></p>
<p class="Pp">probes for all supported formats except RAIDs. This option is only
useful together with <b>--probe</b>.</p>
</div>
<p class="Pp"><b>-U</b>, <b>--uuid</b> <i>uuid</i></p>
<div class="Bd-indent">Look up the device that uses this filesystem <i>uuid</i>.
For more details see the <b>--label</b> option.</div>
<p class="Pp"><b>-h</b>, <b>--help</b></p>
<div class="Bd-indent">Display help text and exit.</div>
<p class="Pp"><b>-V</b>, <b>--version</b></p>
<div class="Bd-indent">Print version and exit.</div>
</section>
<section class="Sh">
<h1 class="Sh" id="EXIT_STATUS"><a class="permalink" href="#EXIT_STATUS">EXIT
STATUS</a></h1>
<p class="Pp">If the specified device or device addressed by specified token
(option <b>--match-token</b>) was found and it’s possible to gather
any information about the device, an exit status 0 is returned. Note the
option <b>--match-tag</b> filters output tags, but it does not affect exit
status.</p>
<p class="Pp">If the specified token was not found, or no (specified) devices
could be identified, or it is impossible to gather any information about the
device identifiers or device content an exit status of 2 is returned.</p>
<p class="Pp">For usage or other errors, an exit status of 4 is returned.</p>
<p class="Pp">If an ambivalent probing result was detected by low-level probing
mode (<b>-p</b>), an exit status of 8 is returned.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="CONFIGURATION_FILE"><a class="permalink" href="#CONFIGURATION_FILE">CONFIGURATION
FILE</a></h1>
<p class="Pp">The standard location of the <i>/etc/blkid.conf</i> config file
can be overridden by the environment variable <b>BLKID_CONF</b>. The
following options control the libblkid library:</p>
<p class="Pp"><i>SEND_UEVENT=<yes|not></i></p>
<div class="Bd-indent">Sends uevent when
<i>/dev/disk/by-{label,uuid,partuuid,partlabel}/</i> symlink does not match
with LABEL, UUID, PARTUUID or PARTLABEL on the device. Default is
"yes".</div>
<p class="Pp"><i>CACHE_FILE=<path></i></p>
<div class="Bd-indent">Overrides the standard location of the cache file. This
setting can be overridden by the environment variable <b>BLKID_FILE</b>.
Default is <i>/run/blkid/blkid.tab</i>, or <i>/etc/blkid.tab</i> on systems
without a <i>/run</i> directory.</div>
<p class="Pp"><i>EVALUATE=<methods></i></p>
<div class="Bd-indent">Defines LABEL and UUID evaluation method(s). Currently,
the libblkid library supports the "udev" and "scan"
methods. More than one method may be specified in a comma-separated list.
Default is "udev,scan". The "udev" method uses udev
<i>/dev/disk/by-*</i> symlinks and the "scan" method scans all block
devices from the <i>/proc/partitions</i> file.</div>
</section>
<section class="Sh">
<h1 class="Sh" id="ENVIRONMENT"><a class="permalink" href="#ENVIRONMENT">ENVIRONMENT</a></h1>
<p class="Pp">Setting <i>LIBBLKID_DEBUG=all</i> enables debug output.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp"><b>blkid</b> was written by Andreas Dilger for libblkid and
improved by Theodore Ts’o and Karel Zak.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><b>libblkid</b>(3), <b>findfs</b>(8), <b>lsblk</b>(8),
<b>wipefs</b>(8)</p>
</section>
<section class="Sh">
<h1 class="Sh" id="REPORTING_BUGS"><a class="permalink" href="#REPORTING_BUGS">REPORTING
BUGS</a></h1>
<p class="Pp">For bug reports, use the issue tracker at <i></i>
<https://github.com/util-linux/util-linux/issues>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AVAILABILITY"><a class="permalink" href="#AVAILABILITY">AVAILABILITY</a></h1>
<p class="Pp">The <b>blkid</b> command is part of the util-linux package which
can be downloaded from <i>Linux Kernel Archive</i>
<https://www.kernel.org/pub/linux/utils/util-linux/>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">2025-01-13</td>
<td class="foot-os">util-linux 2.40.4</td>
</tr>
</table>
</body>
</html>