1BLKID(8) System Administration BLKID(8)
2
3
4
6 blkid - locate/print block device attributes
7
9 blkid --label label | --uuid uuid
10
11
12 blkid [--no-encoding --garbage-collect --list-one --cache-file file]
13 [--output format] [--match-tag tag] [--match-token NAME=value]
14 [device ...]
15
16
17 blkid --probe [--offset offset] [--output format] [--size size]
18 [--match-tag tag] [--match-types list] [--usages list]
19 [--no-part-details] device ...
20
21
22 blkid --info [--output format] [--match-tag tag] device ...
23
24
26 The blkid program is the command-line interface to working with the
27 libblkid(3) library. It can determine the type of content (e.g.,
28 filesystem or swap) that a block device holds, and also the attributes
29 (tokens, NAME=value pairs) from the content metadata (e.g., LABEL or
30 UUID fields).
31
32 It is recommended to use lsblk(8) command to get information about
33 block devices, or lsblk --fs to get an overview of filesystems, or
34 findmnt(8) to search in already mounted filesystems.
35
36 lsblk(8) provides more information, better control on output
37 formatting, easy to use in scripts and it does not require root
38 permissions to get actual information. blkid reads information
39 directly from devices and for non-root users it returns cached
40 unverified information. blkid is mostly designed for system
41 services and to test libblkid functionality.
42
43
44 When device is specified, tokens from only this device are displayed.
45 It is possible to specify multiple device arguments on the command
46 line. If none is given, all partitions or unpartitioned devices which
47 appear in /proc/partitions are shown, if they are recognized.
48
49 blkid has two main forms of operation: either searching for a device
50 with a specific NAME=value pair, or displaying NAME=value pairs for one
51 or more specified devices.
52
53 For security reasons blkid silently ignores all devices where the prob‐
54 ing result is ambivalent (multiple colliding filesystems are detected).
55 The low-level probing mode (-p) provides more information and extra
56 exit status in this case. It's recommended to use wipefs(8) to get a
57 detailed overview and to erase obsolete stuff (magic strings) from the
58 device.
59
60
62 The size and offset arguments may be followed by the multiplicative
63 suffixes like KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB,
64 PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same
65 meaning as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so
66 on for GB, TB, PB, EB, ZB and YB.
67
68 -c, --cache-file cachefile
69 Read from cachefile instead of reading from the default cache
70 file (see the CONFIGURATION FILE section for more details). If
71 you want to start with a clean cache (i.e., don't report devices
72 previously scanned but not necessarily available at this time),
73 specify /dev/null.
74
75 -d, --no-encoding
76 Don't encode non-printing characters. The non-printing charac‐
77 ters are encoded by ^ and M- notation by default. Note that the
78 --output udev output format uses a different encoding which can‐
79 not be disabled.
80
81 -D, --no-part-details
82 Don't print information (PART_ENTRY_* tags) from partition table
83 in low-level probing mode.
84
85 -g, --garbage-collect
86 Perform a garbage collection pass on the blkid cache to remove
87 devices which no longer exist.
88
89 -h, --help
90 Display a usage message and exit.
91
92 -i, --info
93 Display information about I/O Limits (aka I/O topology). The
94 'export' output format is automatically enabled. This option
95 can be used together with the --probe option.
96
97 -k, --list-filesystems
98 List all known filesystems and RAIDs and exit.
99
100 -l, --list-one
101 Look up only one device that matches the search parameter speci‐
102 fied with the --match-token option. If there are multiple
103 devices that match the specified search parameter, then the
104 device with the highest priority is returned, and/or the first
105 device found at a given priority (but see below note about
106 udev). Device types in order of decreasing priority are: Device
107 Mapper, EVMS, LVM, MD, and finally regular block devices. If
108 this option is not specified, blkid will print all of the
109 devices that match the search parameter.
110
111 This option forces blkid to use udev when used for LABEL or UUID
112 tokens in --match-token. The goal is to provide output consis‐
113 tent with other utils (like mount, etc.) on systems where the
114 same tag is used for multiple devices.
115
116 -L, --label label
117 Look up the device that uses this filesystem label; this is
118 equal to --list-one --output device --match-token LABEL=label.
119 This lookup method is able to reliably use /dev/disk/by-label
120 udev symlinks (dependent on a setting in /etc/blkid.conf).
121 Avoid using the symlinks directly; it is not reliable to use the
122 symlinks without verification. The --label option works on sys‐
123 tems with and without udev.
124
125 Unfortunately, the original blkid(8) from e2fsprogs uses the -L
126 option as a synonym for -o list. For better portability, use -l
127 -o device -t LABEL=label and -o list in your scripts rather than
128 the -L option.
129
130 -n, --match-types list
131 Restrict the probing functions to the specified (comma-sepa‐
132 rated) list of superblock types (names). The list items may be
133 prefixed with "no" to specify the types which should be ignored.
134 For example:
135
136 blkid --probe --match-types vfat,ext3,ext4 /dev/sda1
137
138 probes for vfat, ext3 and ext4 filesystems, and
139
140 blkid --probe --match-types nominix /dev/sda1
141
142 probes for all supported formats except minix filesystems. This
143 option is only useful together with --probe.
144
145 -o, --output format
146 Use the specified output format. Note that the order of vari‐
147 ables and devices is not fixed. See also option -s. The format
148 parameter may be:
149
150 full print all tags (the default)
151
152 value print the value of the tags
153
154 list print the devices in a user-friendly format; this output
155 format is unsupported for low-level probing (--probe or
156 --info).
157
158 This output format is DEPRECATED in favour of the
159 lsblk(8) command.
160
161 device print the device name only; this output format is always
162 enabled for the --label and --uuid options
163
164 udev print key="value" pairs for easy import into the udev
165 environment; the keys are prefixed by ID_FS_ or ID_PART_
166 prefixes. The value may be modified to be safe for udev
167 environment; allowed is plain ASCII, hex-escaping and
168 valid UTF-8, everything else (including whitespaces) is
169 replaced with '_'. The keys with _ENC postfix use hex-
170 escaping for unsafe chars.
171
172 The udev output returns the ID_FS_AMBIVALENT tag if more
173 superblocks are detected, and ID_PART_ENTRY_* tags are
174 always returned for all partitions including empty parti‐
175 tions.
176
177 This output format is DEPRECATED.
178
179 export print key=value pairs for easy import into the environ‐
180 ment; this output format is automatically enabled when
181 I/O Limits (--info option) are requested.
182
183 The non-printing characters are encoded by ^ and M- nota‐
184 tion and all potentially unsafe characters are escaped.
185
186 -O, --offset offset
187 Probe at the given offset (only useful with --probe). This
188 option can be used together with the --info option.
189
190 -p, --probe
191 Switch to low-level superblock probing mode (bypassing the
192 cache).
193
194 Note that low-level probing also returns information about par‐
195 tition table type (PTTYPE tag) and partitions (PART_ENTRY_*
196 tags). The tag names produced by low-level probing are based on
197 names used internally by libblkid and it may be different than
198 when executed without --probe (for example PART_ENTRY_UUID= vs
199 PARTUUID=). See also --no-part-details.
200
201 -s, --match-tag tag
202 For each (specified) device, show only the tags that match tag.
203 It is possible to specify multiple --match-tag options. If no
204 tag is specified, then all tokens are shown for all (specified)
205 devices. In order to just refresh the cache without showing any
206 tokens, use --match-tag none with no other options.
207
208 -S, --size size
209 Override the size of device/file (only useful with --probe).
210
211 -t, --match-token NAME=value
212 Search for block devices with tokens named NAME that have the
213 value value, and display any devices which are found. Common
214 values for NAME include TYPE, LABEL, and UUID. If there are no
215 devices specified on the command line, all block devices will be
216 searched; otherwise only the specified devices are searched.
217
218 -u, --usages list
219 Restrict the probing functions to the specified (comma-sepa‐
220 rated) list of "usage" types. Supported usage types are:
221 filesystem, raid, crypto and other. The list items may be pre‐
222 fixed with "no" to specify the usage types which should be
223 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
232 only useful together with --probe.
233
234 -U, --uuid uuid
235 Look up the device that uses this filesystem uuid. For more
236 details see the --label option.
237
238 -V, --version
239 Display version number and exit.
240
242 If the specified device or device addressed by specified token (option
243 --match-token) was found and it's possible to gather any information
244 about the device, an exit status 0 is returned. Note the option
245 --match-tag filters output tags, but it does not affect exit status.
246
247 If the specified token was not found, or no (specified) devices could
248 be identified, or it is impossible to gather any information about the
249 device identifiers or device content an exit status of 2 is returned.
250
251 For usage or other errors, an exit status of 4 is returned.
252
253 If an ambivalent probing result was detected by low-level probing mode
254 (-p), an exit status of 8 is returned.
255
257 The standard location of the /etc/blkid.conf config file can be over‐
258 ridden by the environment variable BLKID_CONF. The following options
259 control the libblkid library:
260
261 SEND_UEVENT=<yes|not>
262 Sends uevent when /dev/disk/by-{label,uuid,partuuid,partlabel}/
263 symlink does not match with LABEL, UUID, PARTUUID or PARTLABEL
264 on the device. Default is "yes".
265
266 CACHE_FILE=<path>
267 Overrides the standard location of the cache file. This setting
268 can be overridden by the environment variable BLKID_FILE.
269 Default is /run/blkid/blkid.tab, or /etc/blkid.tab on systems
270 without a /run directory.
271
272 EVALUATE=<methods>
273 Defines LABEL and UUID evaluation method(s). Currently, the
274 libblkid library supports the "udev" and "scan" methods. More
275 than one method may be specified in a comma-separated list.
276 Default is "udev,scan". The "udev" method uses udev
277 /dev/disk/by-* symlinks and the "scan" method scans all block
278 devices from the /proc/partitions file.
279
281 Setting LIBBLKID_DEBUG=all enables debug output.
282
284 blkid was written by Andreas Dilger for libblkid and improved by
285 Theodore Ts'o and Karel Zak.
286
288 libblkid(3), findfs(8), lsblk(8), wipefs(8)
289
291 The blkid command is part of the util-linux package and is available
292 from https://www.kernel.org/pub/linux/utils/util-linux/.
293
294
295
296util-linux March 2013 BLKID(8)